prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
--// Declarables
|
local L_15_ = false
local L_16_ = false
local L_17_ = true
local L_18_ = L_1_:WaitForChild('Resource')
local L_19_ = L_18_:WaitForChild('FX')
local L_20_ = L_18_:WaitForChild('Events')
local L_21_ = L_18_:WaitForChild('HUD')
local L_22_ = L_18_:WaitForChild('Modules')
local L_23_ = L_18_:WaitForChild('SettingsModule')
local L_24_ = require(L_23_:WaitForChild("ClientConfig"))
local L_25_ = L_18_:WaitForChild('Vars')
local L_26_
local L_27_
local L_28_
local L_29_
local L_30_
local L_31_
local L_32_
local L_33_
local L_34_
local L_35_
local L_36_
local L_37_
local L_38_
local L_39_
local L_40_
local L_41_
local L_42_
local L_43_
local L_44_
local L_45_
local L_46_
local L_47_
local L_48_
local L_49_
local L_50_ = L_24_.AimZoom
local L_51_ = L_24_.MouseSensitivity
local L_52_ = L_12_.MouseDeltaSensitivity
local L_53_ = game.ReplicatedStorage:FindFirstChild('SoundIso_Network') or nil
local L_54_
if L_53_ then
L_54_ = L_53_:WaitForChild('EventConnection')
end
local L_55_ = CFrame.Angles(0, 0, 0)
|
-- print("Wha " .. pose)
|
amplitude = 0.1
frequency = 1
setAngles = true
end
if (setAngles) then
desiredAngle = amplitude * math.sin(time * frequency)
RightShoulder:SetDesiredAngle(desiredAngle + climbFudge)
LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge)
RightHip:SetDesiredAngle(-desiredAngle)
LeftHip:SetDesiredAngle(-desiredAngle)
end
-- Tool Animation handling
local tool = getTool()
if tool then
animStringValueObject = getToolAnim(tool)
if animStringValueObject then
toolAnim = animStringValueObject.Value
-- message recieved, delete StringValue
animStringValueObject.Parent = nil
toolAnimTime = time + .3
end
if time > toolAnimTime then
toolAnimTime = 0
toolAnim = "None"
end
animateTool()
else
stopToolAnimations()
toolAnim = "None"
toolAnimTime = 0
end
end
|
--[=[
@class Mouse
@client
The Mouse class is part of the Input package.
```lua
local Mouse = require(packages.Input).Mouse
```
]=]
|
local Mouse = {}
Mouse.__index = Mouse
|
--[[**
ensures Roblox PathWaypoint type
@param value The value to check against
@returns True iff the condition is satisfied, false otherwise
**--]]
|
t.PathWaypoint = t.typeof("PathWaypoint")
|
--// Declarables
|
local L_4_ = L_1_:WaitForChild('Resource')
local L_5_ = L_4_:WaitForChild('FX')
local L_6_ = L_4_:WaitForChild('Events')
local L_7_ = L_4_:WaitForChild('HUD')
local L_8_ = L_4_:WaitForChild('Modules')
local L_9_ = L_4_:WaitForChild('Vars')
local L_10_ = L_4_:WaitForChild('SettingsModule')
local L_11_ = require(L_10_:WaitForChild('ServerConfig'))
local L_12_
local L_13_
local L_14_
local L_15_
local L_16_
local L_17_
local L_18_
local L_19_
local L_20_
local L_21_
local L_22_
|
--// Set up
|
for L_18_forvar1, L_19_forvar2 in pairs(game.Players:GetChildren()) do
if L_19_forvar2:IsA('Player') and L_19_forvar2.Character and L_19_forvar2.Character.Head then
if L_19_forvar2.TeamColor == L_1_.TeamColor then
if L_19_forvar2.Character.Saude.FireTeam.SquadName.Value ~= '' then
spawnTag(L_19_forvar2.Character, L_19_forvar2.Character.Saude.FireTeam.SquadColor.Value)
else
spawnTag(L_19_forvar2.Character, Color3.fromRGB(255,255,255))
end
end;
end;
end
|
--[=[
@interface KnitOptions
.Middleware Middleware?
@within KnitServer
- Middleware will apply to all services _except_ ones that define
their own middleware.
]=]
|
type KnitOptions = {
Middleware: Middleware?,
}
local defaultOptions: KnitOptions = {
Middleware = nil,
}
local selectedOptions = nil
|
--[[
NumberUtil.E
NumberUtil.Tau
NumberUtil.Lerp(min, max, alpha)
NumberUtil.LerpClamp(min, max, alpha)
NumberUtil.InverseLerp(min, max, num)
NumberUtil.Map(num, inMin, inMax, outMin, outMax)
NumberUtil.Round(num)
NumberUtil.RoundTo(num, multiple)
EXAMPLES:
Lerp:
Interpolate between two numbers by a certain alpha/percentage.
Visually, think of a number line ranging from 'min' to 'max'
and then move along that line by 'alpha' percent.
Lerp(5, 15, 0.5) == 10
Lerp(5, 15, 0) == 5
Lerp(5, 15, 0.7) == 12
Lerp(5, 15, 2) == 25 (unusual to have alpha outside of 0-1. See LerpClamp.)
LerpClamp:
The same as Lerp, but the 'alpha' value is clamped between 0-1,
which will guarantee that the output is within bounds of the
min and max values.
LerpClamp(5, 15, 0.5) == 10
LerpClamp(5, 15, 2) == 15 (alpha of 2 was clamped down to 1)
InverseLerp:
The inverse of the Lerp function. It returns the alpha value
between the range of [min, max] given the number.
InverseLerp(5, 15, 10) == 0.5
InverseLerp(5, 15, 12) == 0.7
Map:
Remaps the range of 'num' from its old range of [inMin, inMax]
to a new range of [outMin, outMax]. This is useful when needing
to convert a range of inputs to a different output. For instance,
remapping gamepad stick input to a larger range controlling a
vehicle steering wheel.
Map(0.5, 0, 1, -10, 10) == 0
Map(1, -1, 1, 0, 5) == 5
Round:
Rounds a number to the nearest whole number.
Round(1.5) == 2
Round(3.2) == 3
Round(-0.5) == -1
RoundTo:
Rounds a number to the nearest given multiple. An example would be
locking world positions onto a larger grid.
RoundTo(3.4, 5) == 5
RoundTo(12, 5) == 10
--]]
|
local NumberUtil = {}
NumberUtil.E = 2.7182818284590
NumberUtil.Tau = math.pi * 2
function NumberUtil.Lerp(min, max, alpha)
return (min + ((max - min) * alpha))
end
function NumberUtil.LerpClamp(min, max, alpha)
return NumberUtil.Lerp(min, max, math.clamp(alpha, 0, 1))
end
function NumberUtil.InverseLerp(min, max, num)
return ((num - min) / (max - min))
end
function NumberUtil.Map(n, inMin, inMax, outMin, outMax)
return (outMin + ((outMax - outMin) * ((n - inMin) / (inMax - inMin))))
end
function NumberUtil.Round(num)
return (num >= 0 and math.floor(num + 0.5) or math.ceil(num - 0.5))
end
function NumberUtil.RoundTo(num, multiple)
return NumberUtil.Round(num / multiple) * multiple
end
return NumberUtil
|
--Precalculated paths
|
local t,f,n=true,false,{}
local r={
[58]={{40,39,41,30,56,58},t},
[49]={{40,38,35,34,32,31,29,28,44,45,49},t},
[16]={n,f},
[19]={{40,39,41,30,56,58,20,19},t},
[59]={{40,39,41,59},t},
[63]={{40,39,41,30,56,58,23,62,63},t},
[34]={{40,38,35,34},t},
[21]={{40,39,41,30,56,58,20,21},t},
[48]={{40,38,35,34,32,31,29,28,44,45,49,48},t},
[27]={{40,38,35,34,32,31,29,28,27},t},
[14]={n,f},
[31]={{40,38,35,34,32,31},t},
[56]={{40,39,41,30,56},t},
[29]={{40,38,35,34,32,31,29},t},
[13]={n,f},
[47]={{40,38,35,34,32,31,29,28,44,45,49,48,47},t},
[12]={n,f},
[45]={{40,38,35,34,32,31,29,28,44,45},t},
[57]={{40,39,41,30,56,57},t},
[36]={{40,38,35,37,36},t},
[25]={{40,38,35,34,32,31,29,28,27,26,25},t},
[71]={{40,39,41,59,61,71},t},
[20]={{40,39,41,30,56,58,20},t},
[60]={{40,39,41,60},t},
[8]={n,f},
[4]={n,f},
[75]={{40,39,41,59,61,71,72,76,73,75},t},
[22]={{40,39,41,30,56,58,20,21,22},t},
[74]={{40,39,41,59,61,71,72,76,73,74},t},
[62]={{40,39,41,30,56,58,23,62},t},
[1]={n,f},
[6]={n,f},
[11]={n,f},
[15]={n,f},
[37]={{40,38,35,37},t},
[2]={n,f},
[35]={{40,38,35},t},
[53]={{40,38,35,34,32,31,29,28,44,45,49,48,47,52,53},t},
[73]={{40,39,41,59,61,71,72,76,73},t},
[72]={{40,39,41,59,61,71,72},t},
[33]={{40,38,35,37,36,33},t},
[69]={{40,39,41,60,69},t},
[65]={{40,39,41,30,56,58,20,19,66,64,65},t},
[26]={{40,38,35,34,32,31,29,28,27,26},t},
[68]={{40,39,41,30,56,58,20,19,66,64,67,68},t},
[76]={{40,39,41,59,61,71,72,76},t},
[50]={{40,38,35,34,32,31,29,28,44,45,49,48,47,50},t},
[66]={{40,39,41,30,56,58,20,19,66},t},
[10]={n,f},
[24]={{40,38,35,34,32,31,29,28,27,26,25,24},t},
[23]={{40,39,41,30,56,58,23},t},
[44]={{40,38,35,34,32,31,29,28,44},t},
[39]={{40,39},t},
[32]={{40,38,35,34,32},t},
[3]={n,f},
[30]={{40,39,41,30},t},
[51]={{40,38,35,34,32,31,29,28,44,45,49,48,47,50,51},t},
[18]={n,f},
[67]={{40,39,41,30,56,58,20,19,66,64,67},t},
[61]={{40,39,41,59,61},t},
[55]={{40,38,35,34,32,31,29,28,44,45,49,48,47,52,53,54,55},t},
[46]={{40,38,35,34,32,31,29,28,44,45,49,48,47,46},t},
[42]={{40,38,42},t},
[40]={{40},t},
[52]={{40,38,35,34,32,31,29,28,44,45,49,48,47,52},t},
[54]={{40,38,35,34,32,31,29,28,44,45,49,48,47,52,53,54},t},
[43]={n,f},
[7]={n,f},
[9]={n,f},
[41]={{40,39,41},t},
[17]={n,f},
[38]={{40,38},t},
[28]={{40,38,35,34,32,31,29,28},t},
[5]={n,f},
[64]={{40,39,41,30,56,58,20,19,66,64},t},
}
return r
|
--// Math
|
local L_121_ = function(L_158_arg1, L_159_arg2, L_160_arg3)
if L_158_arg1 > L_160_arg3 then
return L_160_arg3
elseif L_158_arg1 < L_159_arg2 then
return L_159_arg2
end
return L_158_arg1
end
local L_122_ = L_110_.new(Vector3.new())
L_122_.s = 30
L_122_.d = 0.55
local L_123_ = CFrame.Angles(0, 0, 0)
|
--------------------------------------------------------------------------------------
--------------------[ VARIABLES ]-----------------------------------------------------
--------------------------------------------------------------------------------------
|
local Selected = false
local Idleing = false
local Walking = true
local Running = false
local Aimed = false
local Aiming = false
local Reloading = true
local BreakReload = false
local Knifing = true
local ThrowingGrenade = false
local MB1_Down = false
local CanFire = true
local KnifeReady = true
local CanRun = true
local RunTween = false
local Run_Key_Pressed = false
local ChargingStamina = false
local AimingIn = false
local AimingOut = false
local Stamina = S.SprintTime * 60
local CurrentSteadyTime = S.ScopeSteadyTime * 60
local CameraSteady = false
local TakingBreath = false
local Grip = nil
local Aimed_GripCF = nil
local Gui_Clone = nil
local CurrentSpread = S.Spread.Hipfire
local CurrentRecoil = S.Recoil.Hipfire
local AmmoInClip = 0
local Stance = 0
local StanceSway = 1
local CameraSway = 1
local HeadRot = 0
local ArmTilt = 0
local LastBeat = 0
local Parts = {}
local Connections = {}
local PrevNeckCF = {
C0 = nil;
C1 = nil;
}
local Keys = {}
|
--[[
Creates a Promise that resolves after given number of seconds.
]]
|
do
-- uses a sorted doubly linked list (queue) to achieve O(1) remove operations and O(n) for insert
-- the initial node in the linked list
local first
local connection
function Promise.delay(seconds)
assert(type(seconds) == "number", "Bad argument #1 to Promise.delay, must be a number.")
-- If seconds is -INF, INF, NaN, or less than 1 / 60, assume seconds is 1 / 60.
-- This mirrors the behavior of wait()
if not (seconds >= 1 / 60) or seconds == math.huge then
seconds = 1 / 60
end
return Promise._new(debug.traceback(nil, 2), function(resolve, _, onCancel)
local startTime = Promise._getTime()
local endTime = startTime + seconds
local node = {
resolve = resolve,
startTime = startTime,
endTime = endTime,
}
if connection == nil then -- first is nil when connection is nil
first = node
connection = Promise._timeEvent:Connect(function()
local threadStart = Promise._getTime()
while first ~= nil and first.endTime < threadStart do
local current = first
first = current.next
if first == nil then
connection:Disconnect()
connection = nil
else
first.previous = nil
end
current.resolve(Promise._getTime() - current.startTime)
end
end)
else -- first is non-nil
if first.endTime < endTime then -- if `node` should be placed after `first`
-- we will insert `node` between `current` and `next`
-- (i.e. after `current` if `next` is nil)
local current = first
local next = current.next
while next ~= nil and next.endTime < endTime do
current = next
next = current.next
end
-- `current` must be non-nil, but `next` could be `nil` (i.e. last item in list)
current.next = node
node.previous = current
if next ~= nil then
node.next = next
next.previous = node
end
else
-- set `node` to `first`
node.next = first
first.previous = node
first = node
end
end
onCancel(function()
-- remove node from queue
local next = node.next
if first == node then
if next == nil then -- if `node` is the first and last
connection:Disconnect()
connection = nil
else -- if `node` is `first` and not the last
next.previous = nil
end
first = next
else
local previous = node.previous
-- since `node` is not `first`, then we know `previous` is non-nil
previous.next = next
if next ~= nil then
next.previous = previous
end
end
end)
end)
end
end
|
--[[Engine]]
|
--Torque Curve
Tune.Horsepower = 180 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 6000 -- Use sliders to manipulate values
Tune.Redline = 6700 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 5500
Tune.PeakSharpness = 7.5
Tune.CurveMult = 0.16
--Incline Compensation
Tune.InclineComp = 1.7 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 150 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response)
|
------------------------------------------
|
f:Destroy()
end
end
end
end
script.Parent.Touched:connect(onTouch)
|
-- изменение размера сервисом
-- если нужно дождаться окончания, то нужен таймер ожидания
|
me:TweenSize(
UDim2.new(1, 0, 0, 0), -- endSize (required)
Enum.EasingDirection.InOut, -- easingDirection (default Out) - https://developer.roblox.com/en-us/api-reference/enum/EasingDirection
Enum.EasingStyle.Linear, -- easingStyle (default Quad) - https://developer.roblox.com/en-us/api-reference/enum/EasingStyle
timer -- time (default: 1)
)
wait(timer) -- задержка
|
--/////////////////////////////////////////////////////////--
|
local curSize
local create
local Expand
local doHide
local doClose
local dragSize
local isVisible
local DoRefresh
local getNextPos
local wallPosition
local setPosition
local checkMouse
local isInFrame
local setSize
local apiIfy
client = nil
cPcall = nil
Pcall = nil
Routine = nil
service = nil
GetEnv = nil
local function isGui(child)
return child:IsA("GuiObject");
end
|
--------------------) Settings
|
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 1 -- cooldown for use of the tool again
ZoneModelName = "Dream + ink" -- name the zone model
MobHumanoidName = "Humanoid"-- the name of player or mob u want to damage
|
--------------| SYSTEM SETTINGS |--------------
|
Prefix = ">"; -- The character you use before every command (e.g. ';jump me').
SplitKey = " "; -- The character inbetween command arguments (e.g. setting it to '/' would change ';jump me' to ';jump/me').
BatchKey = "|"; -- The character inbetween batch commands (e.g. setting it to '|' would change ';jump me ;fire me ;smoke me' to ';jump me | ;fire me | ;smoke me'
QualifierBatchKey = ":"; -- The character used to split up qualifiers (e.g. ;jump player1,player2,player3)
Theme = "Blue"; -- The default UI theme.
NoticeSoundId = 2865227271; -- The SoundId for notices.
NoticeVolume = 0.1; -- The Volume for notices.
NoticePitch = 1; -- The Pitch/PlaybackSpeed for notices.
ErrorSoundId = 2865228021; -- The SoundId for error notifications.
ErrorVolume = 0.1; -- The Volume for error notifications.
ErrorPitch = 1; -- The Pitch/PlaybackSpeed for error notifications.
WelcomeBadgeId = 0; -- Award new players a badge, such as 'Welcome to the game!'. Set to 0 for no badge.
CommandDebounce = true; -- Wait until the command effect is over to use again. Helps to limit abuse & lag. Set to 'false' to disable.
SaveRank = true; -- Saves a player's rank in the server they received it. (e.g. ;rank plrName rank). Use ';permRank plrName rank' to permanently save a rank. Set to 'false' to disable.
LoopCommands = 3; -- The minimum rank required to use LoopCommands.
MusicList = {505757009,}; -- Songs which automatically appear in a user's radio. Type '!radio' to display the radio.
ThemeColors = { -- The colours players can set their HD Admin UI (in the 'Settings' menu). | Format: {ThemeName, ThemeColor3Value};
{"Red", Color3.fromRGB(150, 0, 0), };
{"Orange", Color3.fromRGB(150, 75, 0), };
{"Brown", Color3.fromRGB(120, 80, 30), };
{"Yellow", Color3.fromRGB(130, 120, 0), };
{"Green", Color3.fromRGB(0, 120, 0), };
{"Blue", Color3.fromRGB(0, 100, 150), };
{"Purple", Color3.fromRGB(100, 0, 150), };
{"Pink", Color3.fromRGB(150, 0, 100), };
{"Black", Color3.fromRGB(60, 60, 60), };
};
Colors = { -- The colours for ChatColors and command arguments. | Format: {"ShortName", "FullName", Color3Value};
{"r", "Red", Color3.fromRGB(255, 0, 0) };
{"o", "Orange", Color3.fromRGB(250, 100, 0) };
{"y", "Yellow", Color3.fromRGB(255, 255, 0) };
{"g", "Green" , Color3.fromRGB(0, 255, 0) };
{"dg", "DarkGreen" , Color3.fromRGB(0, 125, 0) };
{"b", "Blue", Color3.fromRGB(0, 255, 255) };
{"db", "DarkBlue", Color3.fromRGB(0, 50, 255) };
{"p", "Purple", Color3.fromRGB(150, 0, 255) };
{"pk", "Pink", Color3.fromRGB(255, 85, 185) };
{"bk", "Black", Color3.fromRGB(0, 0, 0) };
{"w", "White", Color3.fromRGB(255, 255, 255) };
};
ChatColors = { -- The colour a player's chat will appear depending on their rank. '["Owner"] = "Yellow";' makes the owner's chat yellow.
[5] = "Yellow";
};
Cmdbar = 1; -- The minimum rank required to use the Cmdbar.
Cmdbar2 = 3; -- The minimum rank required to use the Cmdbar2.
ViewBanland = 3; -- The minimum rank required to view the banland.
OnlyShowUsableCommands = false; -- Only displays commands equal to or below the user's ranks on the Commands page.
RankRequiredToViewPage = { -- || The pages on the main menu ||
["Commands"] = 0;
["Admin"] = 0;
["Settings"] = 0;
};
RankRequiredToViewRank = { -- || The rank categories on the 'Ranks' subPage under Admin ||
["Owner"] = 0;
["HeadAdmin"] = 0;
["Admin"] = 0;
["Mod"] = 0;
["VIP"] = 0;
};
RankRequiredToViewRankType = { -- || The collection of loader-rank-rewarders on the 'Ranks' subPage under Admin ||
["Owner"] = 0;
["SpecificUsers"] = 5;
["Gamepasses"] = 0;
["Assets"] = 0;
["Groups"] = 0;
["Friends"] = 0;
["FreeAdmin"] = 0;
["VipServerOwner"] = 0;
};
WelcomeRankNotice = true; -- The 'You're a [rankName]' notice that appears when you join the game. Set to false to disable.
WelcomeDonorNotice = true; -- The 'You're a Donor' notice that appears when you join the game. Set to false to disable.
WarnIncorrectPrefix = true; -- Warn the user if using the wrong prefix | "Invalid prefix! Try using [correctPrefix][commandName] instead!"
DisableAllNotices = false; -- Set to true to disable all HD Admin notices.
ScaleLimit = 4; -- The maximum size players with a rank lower than 'IgnoreScaleLimit' can scale theirself. For example, players will be limited to ;size me 4 (if limit is 4) - any number above is blocked.
IgnoreScaleLimit = 3; -- Any ranks equal or above this value will ignore 'ScaleLimit'
VIPServerCommandBlacklist = {"permRank", "permBan", "globalAnnouncement"}; -- Commands players are probihited from using in VIP Servers.
GearBlacklist = {67798397}; -- The IDs of gear items to block when using the ;gear command.
IgnoreGearBlacklist = 4; -- The minimum rank required to ignore the gear blacklist.
PlayerDataStoreVersion = "V1.0"; -- Data about the player (i.e. permRanks, custom settings, etc). Changing the Version name will reset all PlayerData.
SystemDataStoreVersion = "V1.0"; -- Data about the game (i.e. the banland, universal message system, etc). Changing the Version name will reset all SystemData.
|
--[[local sounds={
waitForChild(Torso,"GroanSound"),
waitForChild(Torso,"RawrSound")
}]]
|
if healthregen then
local regenscript=waitForChild(sp,"HealthRegenerationScript")
regenscript.Disabled=false
end
Humanoid.WalkSpeed=wonderspeed
local toolAnim="None"
local toolAnimTime=0
|
-- ONLY SUPPORTS ORDINAL TABLES (ARRAYS). An alias that calls table.skip(skip), and then takes [take] entries from the resulting table.
|
Table.skipAndTake = function (tbl, skip, take)
return table.move(tbl, skip + 1, skip + take, 1, table.create(take))
end
|
-- Click Sound
|
local clickSound = Instance.new("Sound")
clickSound.Name = "ClickSound"
clickSound.Volume = 0
clickSound.Parent = iconContainer
|
--Optimization--
|
local rad = math.rad
local random = math.random
local NewCFrame = CFrame.new
local Angles = CFrame.Angles
local NewVector = Vector3.new
local CFLookAt = CFrame.lookAt
local NewInstance = Instance.new
local NewNumberSequence = NumberSequence.new
local NewColorSequence = ColorSequence.new
local ColorKeypoint = ColorSequenceKeypoint.new
local NumberKeypoint = NumberSequenceKeypoint.new
|
-- map a value from one range to another
|
local function map(x: number, inMin: number, inMax: number, outMin: number, outMax: number): number
return (x - inMin)*(outMax - outMin)/(inMax - inMin) + outMin
end
local function playSound(sound: Sound)
sound.TimePosition = 0
sound.Playing = true
end
local function shallowCopy(t)
local out = {}
for k, v in pairs(t) do
out[k] = v
end
return out
end
local function initializeSoundSystem(player: Player, humanoid: Humanoid, rootPart: BasePart)
local sounds: {[string]: Sound} = {}
-- initialize sounds
for name: string, props: {[string]: any} in pairs(SOUND_DATA) do
local sound: Sound = Instance.new("Sound")
sound.Name = name
-- set default values
sound.Archivable = false
sound.EmitterSize = 5
sound.MaxDistance = 150
sound.Volume = 0.65
for propName, propValue: any in pairs(props) do
sound[propName] = propValue
end
sound.Parent = rootPart
sounds[name] = sound
end
local playingLoopedSounds: {[Sound]: boolean?} = {}
local function stopPlayingLoopedSounds(except: Sound?)
for sound in pairs(shallowCopy(playingLoopedSounds)) do
if sound ~= except then
sound.Playing = false
playingLoopedSounds[sound] = nil
end
end
end
-- state transition callbacks.
local stateTransitions: {[Enum.HumanoidStateType]: () -> ()} = {
[Enum.HumanoidStateType.FallingDown] = function()
stopPlayingLoopedSounds()
end,
[Enum.HumanoidStateType.GettingUp] = function()
stopPlayingLoopedSounds()
playSound(sounds.GettingUp)
end,
[Enum.HumanoidStateType.Jumping] = function()
stopPlayingLoopedSounds()
playSound(sounds.Jumping)
end,
[Enum.HumanoidStateType.Swimming] = function()
local verticalSpeed = math.abs(rootPart.Velocity.Y)
if verticalSpeed > 0.1 then
sounds.Splash.Volume = math.clamp(map(verticalSpeed, 100, 350, 0.28, 1), 0, 1)
playSound(sounds.Splash)
end
stopPlayingLoopedSounds(sounds.Swimming)
sounds.Swimming.Playing = true
playingLoopedSounds[sounds.Swimming] = true
end,
[Enum.HumanoidStateType.Freefall] = function()
sounds.FreeFalling.Volume = 0
stopPlayingLoopedSounds(sounds.FreeFalling)
playingLoopedSounds[sounds.FreeFalling] = true
end,
[Enum.HumanoidStateType.Landed] = function()
stopPlayingLoopedSounds()
local verticalSpeed = math.abs(rootPart.Velocity.Y)
if verticalSpeed > 75 then
sounds.Landing.Volume = math.clamp(map(verticalSpeed, 50, 100, 0, 1), 0, 1)
playSound(sounds.Landing)
end
end,
[Enum.HumanoidStateType.Running] = function()
stopPlayingLoopedSounds(sounds.Running)
sounds.Running.Playing = true
playingLoopedSounds[sounds.Running] = true
end,
[Enum.HumanoidStateType.Climbing] = function()
local sound = sounds.Climbing
if math.abs(rootPart.Velocity.Y) > 0.1 then
sound.Playing = true
stopPlayingLoopedSounds(sound)
else
stopPlayingLoopedSounds()
end
playingLoopedSounds[sound] = true
end,
[Enum.HumanoidStateType.Seated] = function()
stopPlayingLoopedSounds()
end,
[Enum.HumanoidStateType.Dead] = function()
stopPlayingLoopedSounds()
playSound(sounds.Died)
end,
}
-- updaters for looped sounds
local loopedSoundUpdaters: {[Sound]: (number, Sound, Vector3) -> ()} = {
[sounds.Climbing] = function(dt: number, sound: Sound, vel: Vector3)
sound.Playing = vel.Magnitude > 0.1
end,
[sounds.FreeFalling] = function(dt: number, sound: Sound, vel: Vector3): ()
if vel.Magnitude > 75 then
sound.Volume = math.clamp(sound.Volume + 0.9*dt, 0, 1)
else
sound.Volume = 0
end
end,
[sounds.Running] = function(dt: number, sound: Sound, vel: Vector3)
sound.Playing = vel.Magnitude > 0.5 and humanoid.MoveDirection.Magnitude > 0.5
end,
}
-- state substitutions to avoid duplicating entries in the state table
local stateRemap: {[Enum.HumanoidStateType]: Enum.HumanoidStateType} = {
[Enum.HumanoidStateType.RunningNoPhysics] = Enum.HumanoidStateType.Running,
}
local activeState: Enum.HumanoidStateType = stateRemap[humanoid:GetState()] or humanoid:GetState()
local stateChangedConn = humanoid.StateChanged:Connect(function(_, state)
state = stateRemap[state] or state
if state ~= activeState then
local transitionFunc: () -> () = stateTransitions[state]
if transitionFunc then
transitionFunc()
end
activeState = state
end
end)
local steppedConn = RunService.Stepped:Connect(function(_, worldDt: number)
-- update looped sounds on stepped
for sound in pairs(playingLoopedSounds) do
local updater: (number, Sound, Vector3) -> () = loopedSoundUpdaters[sound]
if updater then
updater(worldDt, sound, rootPart.Velocity)
end
end
end)
local humanoidAncestryChangedConn: RBXScriptConnection
local rootPartAncestryChangedConn: RBXScriptConnection
local characterAddedConn: RBXScriptConnection
local function terminate()
stateChangedConn:Disconnect()
steppedConn:Disconnect()
humanoidAncestryChangedConn:Disconnect()
rootPartAncestryChangedConn:Disconnect()
characterAddedConn:Disconnect()
end
humanoidAncestryChangedConn = humanoid.AncestryChanged:Connect(function(_, parent)
if not parent then
terminate()
end
end)
rootPartAncestryChangedConn = rootPart.AncestryChanged:Connect(function(_, parent)
if not parent then
terminate()
end
end)
characterAddedConn = player.CharacterAdded:Connect(terminate)
end
local function playerAdded(player: Player)
local function characterAdded(character)
-- Avoiding memory leaks in the face of Character/Humanoid/RootPart lifetime has a few complications:
-- * character deparenting is a Remove instead of a Destroy, so signals are not cleaned up automatically.
-- ** must use a waitForFirst on everything and listen for hierarchy changes.
-- * the character might not be in the dm by the time CharacterAdded fires
-- ** constantly check consistency with player.Character and abort if CharacterAdded is fired again
-- * Humanoid may not exist immediately, and by the time it's inserted the character might be deparented.
-- * RootPart probably won't exist immediately.
-- ** by the time RootPart is inserted and Humanoid.RootPart is set, the character or the humanoid might be deparented.
if not character.Parent then
waitForFirst(character.AncestryChanged, player.CharacterAdded)
end
if player.Character ~= character or not character.Parent then
return
end
local humanoid = character:FindFirstChildOfClass("Humanoid")
while character:IsDescendantOf(game) and not humanoid do
waitForFirst(character.ChildAdded, character.AncestryChanged, player.CharacterAdded)
humanoid = character:FindFirstChildOfClass("Humanoid")
end
if player.Character ~= character or not character:IsDescendantOf(game) then
return
end
-- must rely on HumanoidRootPart naming because Humanoid.RootPart does not fire changed signals
local rootPart = character:FindFirstChild("HumanoidRootPart")
while character:IsDescendantOf(game) and not rootPart do
waitForFirst(character.ChildAdded, character.AncestryChanged, humanoid.AncestryChanged, player.CharacterAdded)
rootPart = character:FindFirstChild("HumanoidRootPart")
end
if rootPart and humanoid:IsDescendantOf(game) and character:IsDescendantOf(game) and player.Character == character then
initializeSoundSystem(player, humanoid, rootPart)
end
end
if player.Character then
characterAdded(player.Character)
end
player.CharacterAdded:Connect(characterAdded)
end
Players.PlayerAdded:Connect(playerAdded)
for _, player in ipairs(Players:GetPlayers()) do
playerAdded(player)
end
|
-- Returns true if the client is
-- currently in first person.
|
function FpsCamera:IsInFirstPerson()
local camera = workspace.CurrentCamera
if camera then
if camera.CameraType.Name == "Scriptable" then
return false
end
local focus = camera.Focus.Position
local origin = camera.CFrame.Position
return (focus - origin).Magnitude <= 1
end
return false
end
|
--[=[
Converts to the string to `lowerCamelCase` from `camelCase` or `snakeCase` or `YELL_CASE`
@param str string
@return string
]=]
|
function String.toLowerCamelCase(str: string): string
str = str:lower()
str = str:gsub("[ _](%a)", string.upper)
str = str:gsub("^%a", string.lower)
str = str:gsub("%p", "")
return str
end
|
--SKP_23.TintColor = Color3.new(1,(math.ceil(SKP_7.Health/2)/math.ceil(SKP_20)),(math.ceil(SKP_7.Health/2)/math.ceil(SKP_20)))
|
SKP_10:Create(SKP_22,TweenInfo.new(3 * Hurt,Enum.EasingStyle.Sine,Enum.EasingDirection.In,0,false,0),{Size = 0}):Play()
|
--cc.Parent = nil
|
local Finished = 0
local AF = 0
for l,i in pairs(Edit) do
AF = AF+1
|
--dictionary<string, Variant> Data
--* custom data attached to this node
|
Response.Data = {}
|
--CHANGE THE NAME, COPY ALL BELOW, AND PAST INTO COMMAND BAR
|
local TycoonName = "Tycoon"
if game.Workspace:FindFirstChild(TycoonName) then
local s = nil
local bTycoon = game.Workspace:FindFirstChild(TycoonName)
local zTycoon = game.Workspace:FindFirstChild("Zednov's Tycoon Kit")
local new_Collector = zTycoon['READ ME'].Script:Clone()
local Gate = zTycoon.Tycoons:GetChildren()[1].Entrance['Touch to claim!'].GateControl:Clone()
if zTycoon then
for i,v in pairs(zTycoon.Tycoons:GetChildren()) do --Wipe current tycoon 'demo'
if v then
s = v.PurchaseHandler:Clone()
v:Destroy()
end
end
-- Now make it compatiable
if s ~= nil then
for i,v in pairs(bTycoon.Tycoons:GetChildren()) do
local New_Tycoon = v:Clone()
New_Tycoon:FindFirstChild('PurchaseHandler'):Destroy()
s:Clone().Parent = New_Tycoon
local Team_C = Instance.new('BrickColorValue',New_Tycoon)
Team_C.Value = BrickColor.new(tostring(v.Name))
Team_C.Name = "TeamColor"
New_Tycoon.Name = v.TeamName.Value
New_Tycoon.Cash.Name = "CurrencyToCollect"
New_Tycoon.Parent = zTycoon.Tycoons
New_Tycoon.TeamName:Destroy()
v:Destroy()
New_Tycoon.Essentials:FindFirstChild('Cash to collect: $0').NameUpdater:Destroy()
local n = new_Collector:Clone()
n.Parent = New_Tycoon.Essentials:FindFirstChild('Cash to collect: $0')
n.Disabled = false
New_Tycoon.Gate['Touch to claim ownership!'].GateControl:Destroy()
local g = Gate:Clone()
g.Parent = New_Tycoon.Gate['Touch to claim ownership!']
end
else
error("Please don't tamper with script names or this won't work!")
end
else
error("Please don't change the name of our tycoon kit or it won't work!")
end
bTycoon:Destroy()
Gate:Destroy()
new_Collector:Destroy()
print('Transfer complete! :)')
else
error("Check if you spelt the kit's name wrong!")
end
|
--// Event for making player say chat message.
|
function chatBarFocusLost(enterPressed, inputObject)
DoBackgroundFadeIn()
chatBarFocusChanged:Fire(false)
if (enterPressed) then
local message = ChatBar:GetTextBox().Text
if ChatBar:IsInCustomState() then
local customMessage = ChatBar:GetCustomMessage()
if customMessage then
message = customMessage
end
local messageSunk = ChatBar:CustomStateProcessCompletedMessage(message)
ChatBar:ResetCustomState()
if messageSunk then
return
end
end
message = string.sub(message, 1, ChatSettings.MaximumMessageLength)
ChatBar:GetTextBox().Text = ""
if message ~= "" then
--// Sends signal to eventually call Player:Chat() to handle C++ side legacy stuff.
moduleApiTable.MessagePosted:fire(message)
if not CommandProcessor:ProcessCompletedChatMessage(message, ChatWindow) then
if ChatSettings.DisallowedWhiteSpace then
for i = 1, #ChatSettings.DisallowedWhiteSpace do
if ChatSettings.DisallowedWhiteSpace[i] == "\t" then
message = string.gsub(message, ChatSettings.DisallowedWhiteSpace[i], " ")
else
message = string.gsub(message, ChatSettings.DisallowedWhiteSpace[i], "")
end
end
end
message = string.gsub(message, "\n", "")
message = string.gsub(message, "[ ]+", " ")
local targetChannel = ChatWindow:GetTargetMessageChannel()
if targetChannel then
MessageSender:SendMessage(message, targetChannel)
else
MessageSender:SendMessage(message, nil)
end
end
end
end
end
local ChatBarConnections = {}
function setupChatBarConnections()
for i = 1, #ChatBarConnections do
ChatBarConnections[i]:Disconnect()
end
ChatBarConnections = {}
local focusLostConnection = ChatBar:GetTextBox().FocusLost:connect(chatBarFocusLost)
table.insert(ChatBarConnections, focusLostConnection)
local focusGainedConnection = ChatBar:GetTextBox().Focused:connect(chatBarFocused)
table.insert(ChatBarConnections, focusGainedConnection)
end
setupChatBarConnections()
ChatBar.GuiObjectsChanged:connect(setupChatBarConnections)
EventFolder.OnMessageDoneFiltering.OnClientEvent:connect(function(messageData)
if not ChatSettings.ShowUserOwnFilteredMessage then
if messageData.FromSpeaker == LocalPlayer.Name then
return
end
end
local channelName = messageData.OriginalChannel
local channelObj = ChatWindow:GetChannel(channelName)
if channelObj then
channelObj:UpdateMessageFiltered(messageData)
end
if ChatSettings.GeneralChannelName and channelName ~= ChatSettings.GeneralChannelName then
local generalChannel = ChatWindow:GetChannel(ChatSettings.GeneralChannelName)
if generalChannel then
generalChannel:UpdateMessageFiltered(messageData)
end
end
end)
EventFolder.OnNewMessage.OnClientEvent:connect(function(messageData, channelName)
local channelObj = ChatWindow:GetChannel(channelName)
if (channelObj) then
channelObj:AddMessageToChannel(messageData)
if (messageData.FromSpeaker ~= LocalPlayer.Name) then
ChannelsBar:UpdateMessagePostedInChannel(channelName)
end
local generalChannel = nil
if (ChatSettings.GeneralChannelName and channelName ~= ChatSettings.GeneralChannelName) then
generalChannel = ChatWindow:GetChannel(ChatSettings.GeneralChannelName)
if (generalChannel) then
generalChannel:AddMessageToChannel(messageData)
end
end
moduleApiTable.MessageCount = moduleApiTable.MessageCount + 1
moduleApiTable.MessagesChanged:fire(moduleApiTable.MessageCount)
DoFadeInFromNewInformation()
end
end)
EventFolder.OnNewSystemMessage.OnClientEvent:connect(function(messageData, channelName)
channelName = channelName or "System"
local channelObj = ChatWindow:GetChannel(channelName)
if (channelObj) then
channelObj:AddMessageToChannel(messageData)
ChannelsBar:UpdateMessagePostedInChannel(channelName)
moduleApiTable.MessageCount = moduleApiTable.MessageCount + 1
moduleApiTable.MessagesChanged:fire(moduleApiTable.MessageCount)
DoFadeInFromNewInformation()
if (ChatSettings.GeneralChannelName and channelName ~= ChatSettings.GeneralChannelName) then
local generalChannel = ChatWindow:GetChannel(ChatSettings.GeneralChannelName)
if (generalChannel) then
generalChannel:AddMessageToChannel(messageData)
end
end
else
warn(string.format("Just received system message for channel I'm not in [%s]", channelName))
end
end)
function HandleChannelJoined(channel, welcomeMessage, messageLog, channelNameColor, addHistoryToGeneralChannel,
addWelcomeMessageToGeneralChannel)
if ChatWindow:GetChannel(channel) then
--- If the channel has already been added, remove it first.
ChatWindow:RemoveChannel(channel)
end
if (channel == ChatSettings.GeneralChannelName) then
DidFirstChannelsLoads = true
end
if channelNameColor then
ChatBar:SetChannelNameColor(channel, channelNameColor)
end
local channelObj = ChatWindow:AddChannel(channel)
if (channelObj) then
if (channel == "All") then
DoSwitchCurrentChannel(channel)
end
if (messageLog) then
local startIndex = 1
if #messageLog > ChatSettings.MessageHistoryLengthPerChannel then
startIndex = #messageLog - ChatSettings.MessageHistoryLengthPerChannel
end
for i = startIndex, #messageLog do
channelObj:AddMessageToChannel(messageLog[i])
end
if addHistoryToGeneralChannel then
if ChatSettings.GeneralChannelName and channel ~= ChatSettings.GeneralChannelName then
local generalChannel = ChatWindow:GetChannel(ChatSettings.GeneralChannelName)
if generalChannel then
generalChannel:AddMessagesToChannelByTimeStamp(messageLog, startIndex)
end
end
end
end
if (welcomeMessage ~= "") then
local welcomeMessageObject = {
ID = -1,
FromSpeaker = nil,
SpeakerUserId = 0,
OriginalChannel = channel,
IsFiltered = true,
MessageLength = string.len(welcomeMessage),
Message = trimTrailingSpaces(welcomeMessage),
MessageType = ChatConstants.MessageTypeWelcome,
Time = os.time(),
ExtraData = nil,
}
channelObj:AddMessageToChannel(welcomeMessageObject)
if addWelcomeMessageToGeneralChannel and not ChatSettings.ShowChannelsBar then
if channel ~= ChatSettings.GeneralChannelName then
local generalChannel = ChatWindow:GetChannel(ChatSettings.GeneralChannelName)
if generalChannel then
generalChannel:AddMessageToChannel(welcomeMessageObject)
end
end
end
end
DoFadeInFromNewInformation()
end
end
EventFolder.OnChannelJoined.OnClientEvent:connect(function(channel, welcomeMessage, messageLog, channelNameColor)
HandleChannelJoined(channel, welcomeMessage, messageLog, channelNameColor, false, true)
end)
EventFolder.OnChannelLeft.OnClientEvent:connect(function(channel)
ChatWindow:RemoveChannel(channel)
DoFadeInFromNewInformation()
end)
EventFolder.OnMuted.OnClientEvent:connect(function(channel)
--// Do something eventually maybe?
--// This used to take away the chat bar in channels the player was muted in.
--// We found out this behavior was inconvenient for doing chat commands though.
end)
EventFolder.OnUnmuted.OnClientEvent:connect(function(channel)
--// Same as above.
end)
EventFolder.OnMainChannelSet.OnClientEvent:connect(function(channel)
DoSwitchCurrentChannel(channel)
end)
coroutine.wrap(function()
-- ChannelNameColorUpdated may not exist if the client version is older than the server version.
local ChannelNameColorUpdated = DefaultChatSystemChatEvents:WaitForChild("ChannelNameColorUpdated", 5)
if ChannelNameColorUpdated then
ChannelNameColorUpdated.OnClientEvent:connect(function(channelName, channelNameColor)
ChatBar:SetChannelNameColor(channelName, channelNameColor)
end)
end
end)()
|
--wait(0.2)
|
local LP = script.Assets.LeanPatcher:Clone()
LP.Parent = script.Parent
LP.Disabled = false
|
--[[
Creating a message creator module:
1) Create a new module inside the MessageCreatorModules folder.
2) Create a function that takes a messageData object and returns:
{
KEY_BASE_FRAME = BaseFrame,
KEY_BASE_MESSAGE = BaseMessage,
KEY_UPDATE_TEXT_FUNC = function(newMessageObject) ---Function to update the text of the message.
KEY_GET_HEIGHT = function() ---Function to get the height of the message in absolute pixels,
KEY_FADE_IN = function(duration, CurveUtil) ---Function to tell the message to start fading in.
KEY_FADE_OUT = function(duration, CurveUtil) ---Function to tell the message to start fading out.
KEY_UPDATE_ANIMATION = function(dtScale, CurveUtil) ---Update animation function.
}
3) return the following format from the module:
{
KEY_MESSAGE_TYPE = "Message type this module creates messages for."
KEY_CREATOR_FUNCTION = YourFunctionHere
}
--]]
|
local DEFAULT_MESSAGE_CREATOR = "UnknownMessage"
local MESSAGE_CREATOR_MODULES_VERSION = 1
|
-- Roblox character sound script
|
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local L_1_ = game.Players.LocalPlayer
local L_2_ = L_1_.Character
local SOUND_DATA = {
Climbing = {
SoundId = "rbxasset://sounds/action_footsteps_plastic.mp3",
Looped = true,
},
Died = {
SoundId = "rbxasset://sounds/uuhhh.mp3",
},
FreeFalling = {
SoundId = "rbxasset://sounds/action_falling.mp3",
Looped = true,
},
GettingUp = {
SoundId = "rbxasset://sounds/action_get_up.mp3",
},
Jumping = {
SoundId = "rbxasset://sounds/action_jump.mp3",
},
Landing = {
SoundId = "rbxasset://sounds/action_jump_land.mp3",
},
Running = {
SoundId = '' ,
Looped = true,
Playing = true,
Pitch = 1,
},
Splash = {
SoundId = "rbxasset://sounds/impact_water.mp3",
},
Swimming = {
SoundId = "rbxasset://sounds/action_swim.mp3",
Looped = true,
Pitch = 1.6,
},
}
-- wait for the first of the passed signals to fire
local function waitForFirst(...)
local shunt = Instance.new("BindableEvent")
local slots = {...}
local function fire(...)
for i = 1, #slots do
slots[i]:Disconnect()
end
return shunt:Fire(...)
end
for i = 1, #slots do
slots[i] = slots[i]:Connect(fire)
end
return shunt.Event:Wait()
end
|
--This is just some simple server script that moves the object around every frame
--The kinematics module handles the rest
|
game["Run Service"].Heartbeat:Connect(function(deltaTime)
local speed = script:GetAttribute("speed") or Vector3.zero
local size = script:GetAttribute("size") or 3
total+=deltaTime
part.CFrame = startPos * CFrame.new(Vector3.new(math.sin(total*speed.x)*size,math.sin(total*speed.y)*size, math.sin(total*speed.z)*size))
end)
|
--[[
Client init file
]]
|
local RunService = game:GetService("RunService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
wait()
local UIController = require(ReplicatedStorage.Source.Controllers.UIController)
local ClientPlayerStatusHandler = require(ReplicatedStorage.Source.Player.ClientPlayerStatusHandler)
local Constants = require(ReplicatedStorage.Source.Common.Constants)
local Logger = require(ReplicatedStorage.Dependencies.GameUtils.Logger)
local translateDataModel = require(ReplicatedStorage.Source.Common.translateDataModel)
Logger.setCutoff(Constants.LoggerLevel.Warn)
ClientPlayerStatusHandler.init()
if game.PlaceId ~= 0 and RunService:IsClient() then
translateDataModel()
end
|
--[[ The Module ]]
|
--
local BaseCharacterController = require(script.Parent:WaitForChild("BaseCharacterController"))
local TouchJump = setmetatable({}, BaseCharacterController)
TouchJump.__index = TouchJump
function TouchJump.new()
local self = setmetatable(BaseCharacterController.new(), TouchJump)
self.parentUIFrame = nil
self.jumpButton = nil
self.characterAddedConn = nil
self.humanoidStateEnabledChangedConn = nil
self.humanoidJumpPowerConn = nil
self.humanoidParentConn = nil
self.externallyEnabled = false
self.jumpPower = 0
self.jumpStateEnabled = true
self.isJumping = false
self.humanoid = nil -- saved reference because property change connections are made using it
return self
end
function TouchJump:EnableButton(enable)
if enable then
if not self.jumpButton then
self:Create()
end
local humanoid = Players.LocalPlayer.Character and Players.LocalPlayer.Character:FindFirstChildOfClass("Humanoid")
if humanoid and self.externallyEnabled then
if self.externallyEnabled then
if humanoid.JumpPower > 0 then
self.jumpButton.Visible = true
end
end
end
else
self.jumpButton.Visible = false
self.isJumping = false
self.jumpButton.ImageRectOffset = Vector2.new(1, 146)
end
end
function TouchJump:UpdateEnabled()
if self.jumpPower > 0 and self.jumpStateEnabled then
self:EnableButton(true)
else
self:EnableButton(false)
end
end
function TouchJump:HumanoidChanged(prop)
local humanoid = Players.LocalPlayer.Character and Players.LocalPlayer.Character:FindFirstChildOfClass("Humanoid")
if humanoid then
if prop == "JumpPower" then
self.jumpPower = humanoid.JumpPower
self:UpdateEnabled()
elseif prop == "Parent" then
if not humanoid.Parent then
self.humanoidChangeConn:Disconnect()
end
end
end
end
function TouchJump:HumanoidStateEnabledChanged(state, isEnabled)
if state == Enum.HumanoidStateType.Jumping then
self.jumpStateEnabled = isEnabled
self:UpdateEnabled()
end
end
function TouchJump:CharacterAdded(char)
if self.humanoidChangeConn then
self.humanoidChangeConn:Disconnect()
self.humanoidChangeConn = nil
end
self.humanoid = char:FindFirstChildOfClass("Humanoid")
while not self.humanoid do
char.ChildAdded:wait()
self.humanoid = char:FindFirstChildOfClass("Humanoid")
end
self.humanoidJumpPowerConn = self.humanoid:GetPropertyChangedSignal("JumpPower"):Connect(function()
self.jumpPower = self.humanoid.JumpPower
self:UpdateEnabled()
end)
self.humanoidParentConn = self.humanoid:GetPropertyChangedSignal("Parent"):Connect(function()
if not self.humanoid.Parent then
self.humanoidJumpPowerConn:Disconnect()
self.humanoidJumpPowerConn = nil
self.humanoidParentConn:Disconnect()
self.humanoidParentConn = nil
end
end)
self.humanoidStateEnabledChangedConn = self.humanoid.StateEnabledChanged:Connect(function(state, enabled)
self:HumanoidStateEnabledChanged(state, enabled)
end)
self.jumpPower = self.humanoid.JumpPower
self.jumpStateEnabled = self.humanoid:GetStateEnabled(Enum.HumanoidStateType.Jumping)
self:UpdateEnabled()
end
function TouchJump:SetupCharacterAddedFunction()
self.characterAddedConn = Players.LocalPlayer.CharacterAdded:Connect(function(char)
self:CharacterAdded(char)
end)
if Players.LocalPlayer.Character then
self:CharacterAdded(Players.LocalPlayer.Character)
end
end
function TouchJump:Enable(enable, parentFrame)
if parentFrame then
self.parentUIFrame = parentFrame
end
self.externallyEnabled = enable
self:EnableButton(enable)
end
function TouchJump:Create()
if not self.parentUIFrame then
return
end
if self.jumpButton then
self.jumpButton:Destroy()
self.jumpButton = nil
end
local minAxis = math.min(self.parentUIFrame.AbsoluteSize.x, self.parentUIFrame.AbsoluteSize.y)
local isSmallScreen = minAxis <= 500
local jumpButtonSize = isSmallScreen and 70 or 120
self.jumpButton = Instance.new("ImageButton")
self.jumpButton.Name = "JumpButton"
self.jumpButton.Visible = false
self.jumpButton.BackgroundTransparency = 1
self.jumpButton.Image = TOUCH_CONTROL_SHEET
self.jumpButton.ImageRectOffset = Vector2.new(1, 146)
self.jumpButton.ImageRectSize = Vector2.new(144, 144)
self.jumpButton.Size = UDim2.new(0, jumpButtonSize, 0, jumpButtonSize)
self.jumpButton.Position = isSmallScreen and UDim2.new(1, -(jumpButtonSize*1.5-10), 1, -jumpButtonSize - 20) or
UDim2.new(1, -(jumpButtonSize*1.5-10), 1, -jumpButtonSize * 1.75)
local touchObject = nil
self.jumpButton.InputBegan:connect(function(inputObject)
--A touch that starts elsewhere on the screen will be sent to a frame's InputBegan event
--if it moves over the frame. So we check that this is actually a new touch (inputObject.UserInputState ~= Enum.UserInputState.Begin)
if touchObject or inputObject.UserInputType ~= Enum.UserInputType.Touch
or inputObject.UserInputState ~= Enum.UserInputState.Begin then
return
end
touchObject = inputObject
self.jumpButton.ImageRectOffset = Vector2.new(146, 146)
self.isJumping = true
end)
local OnInputEnded = function()
touchObject = nil
self.isJumping = false
self.jumpButton.ImageRectOffset = Vector2.new(1, 146)
end
self.jumpButton.InputEnded:connect(function(inputObject)
if inputObject == touchObject then
OnInputEnded()
end
end)
GuiService.MenuOpened:connect(function()
if touchObject then
OnInputEnded()
end
end)
if not self.characterAddedConn then
self:SetupCharacterAddedFunction()
end
self.jumpButton.Parent = self.parentUIFrame
end
return TouchJump
|
-- body.FB.BrickColor = bool and BrickColor.new("Pearl") or BrickColor.new("Black")
|
body.FB.Material = bool and "Neon" or "SmoothPlastic"
body.FB.Light.Enabled = bool
body.RB.Material = bool and "Neon" or "SmoothPlastic"
body.RB.Light.Enabled = bool
body.RF.Material = bool and "Neon" or "SmoothPlastic"
body.HB2.Material = bool and "Neon" or "SmoothPlastic"
body.HB2.Light.Enabled = bool
|
---
|
local Paint = false
script.Parent.MouseButton1Click:connect(function()
Paint = not Paint
handler:FireServer("Grime",Paint)
end)
|
--[[
Package link auto-generated by Rotriever
]]
|
local PackageIndex = script.Parent.Parent.Parent._Index
local Package = require(PackageIndex["PrettyFormat"]["PrettyFormat"])
export type Colors = Package.Colors
export type CompareKeys = Package.CompareKeys
export type Config = Package.Config
export type Options = Package.Options
export type OptionsReceived = Package.OptionsReceived
export type OldPlugin = Package.OldPlugin
export type NewPlugin = Package.NewPlugin
export type Plugin = Package.Plugin
export type Plugins = Package.Plugins
export type PrettyFormatOptions = Package.PrettyFormatOptions
export type Printer = Package.Printer
export type Refs = Package.Refs
export type Theme = Package.Theme
return Package
|
-- declarations
|
local Torso=waitForChild(sp,"Torso")
local Head=waitForChild(sp,"Head")
local RightShoulder=waitForChild(Torso,"Right Shoulder")
local LeftShoulder=waitForChild(Torso,"Left Shoulder")
local RightHip=waitForChild(Torso,"Right Hip")
local LeftHip=waitForChild(Torso,"Left Hip")
local Neck=waitForChild(Torso,"Neck")
local Humanoid=waitForChild(sp,"Humanoid")
local BodyColors=waitForChild(sp,"Body Colors")
local pose="Standing"
local hitsound=waitForChild(Torso,"HitSound")
local Anim = Humanoid:LoadAnimation(sp.AttackAnim)
|
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------JSON Functions Begin----------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
|
--JSON Encoder and Parser for Lua 5.1
--
--Copyright 2007 Shaun Brown (http://www.chipmunkav.com)
--All Rights Reserved.
--Permission is hereby granted, free of charge, to any person
--obtaining a copy of this software to deal in the Software without
--restriction, including without limitation the rights to use,
--copy, modify, merge, publish, distribute, sublicense, and/or
--sell copies of the Software, and to permit persons to whom the
--Software is furnished to do so, subject to the following conditions:
--The above copyright notice and this permission notice shall be
--included in all copies or substantial portions of the Software.
--If you find this software useful please give www.chipmunkav.com a mention.
--THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
--EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
--OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
--IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
--ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
--CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
--CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
local string = string
local math = math
local table = table
local error = error
local tonumber = tonumber
local tostring = tostring
local type = type
local setmetatable = setmetatable
local pairs = pairs
local ipairs = ipairs
local assert = assert
local StringBuilder = {
buffer = {}
}
function StringBuilder:New()
local o = {}
setmetatable(o, self)
self.__index = self
o.buffer = {}
return o
end
function StringBuilder:Append(s)
self.buffer[#self.buffer+1] = s
end
function StringBuilder:ToString()
return table.concat(self.buffer)
end
local JsonWriter = {
backslashes = {
['\b'] = "\\b",
['\t'] = "\\t",
['\n'] = "\\n",
['\f'] = "\\f",
['\r'] = "\\r",
['"'] = "\\\"",
['\\'] = "\\\\",
['/'] = "\\/"
}
}
function JsonWriter:New()
local o = {}
o.writer = StringBuilder:New()
setmetatable(o, self)
self.__index = self
return o
end
function JsonWriter:Append(s)
self.writer:Append(s)
end
function JsonWriter:ToString()
return self.writer:ToString()
end
function JsonWriter:Write(o)
local t = type(o)
if t == "nil" then
self:WriteNil()
elseif t == "boolean" then
self:WriteString(o)
elseif t == "number" then
self:WriteString(o)
elseif t == "string" then
self:ParseString(o)
elseif t == "table" then
self:WriteTable(o)
elseif t == "function" then
self:WriteFunction(o)
elseif t == "thread" then
self:WriteError(o)
elseif t == "userdata" then
self:WriteError(o)
end
end
function JsonWriter:WriteNil()
self:Append("null")
end
function JsonWriter:WriteString(o)
self:Append(tostring(o))
end
function JsonWriter:ParseString(s)
self:Append('"')
self:Append(string.gsub(s, "[%z%c\\\"/]", function(n)
local c = self.backslashes[n]
if c then return c end
return string.format("\\u%.4X", string.byte(n))
end))
self:Append('"')
end
function JsonWriter:IsArray(t)
local count = 0
local isindex = function(k)
if type(k) == "number" and k > 0 then
if math.floor(k) == k then
return true
end
end
return false
end
for k,v in pairs(t) do
if not isindex(k) then
return false, '{', '}'
else
count = math.max(count, k)
end
end
return true, '[', ']', count
end
function JsonWriter:WriteTable(t)
local ba, st, et, n = self:IsArray(t)
self:Append(st)
if ba then
for i = 1, n do
self:Write(t[i])
if i < n then
self:Append(',')
end
end
else
local first = true;
for k, v in pairs(t) do
if not first then
self:Append(',')
end
first = false;
self:ParseString(k)
self:Append(':')
self:Write(v)
end
end
self:Append(et)
end
function JsonWriter:WriteError(o)
error(string.format(
"Encoding of %s unsupported",
tostring(o)))
end
function JsonWriter:WriteFunction(o)
if o == Null then
self:WriteNil()
else
self:WriteError(o)
end
end
local StringReader = {
s = "",
i = 0
}
function StringReader:New(s)
local o = {}
setmetatable(o, self)
self.__index = self
o.s = s or o.s
return o
end
function StringReader:Peek()
local i = self.i + 1
if i <= #self.s then
return string.sub(self.s, i, i)
end
return nil
end
function StringReader:Next()
self.i = self.i+1
if self.i <= #self.s then
return string.sub(self.s, self.i, self.i)
end
return nil
end
function StringReader:All()
return self.s
end
local JsonReader = {
escapes = {
['t'] = '\t',
['n'] = '\n',
['f'] = '\f',
['r'] = '\r',
['b'] = '\b',
}
}
function JsonReader:New(s)
local o = {}
o.reader = StringReader:New(s)
setmetatable(o, self)
self.__index = self
return o;
end
function JsonReader:Read()
self:SkipWhiteSpace()
local peek = self:Peek()
if peek == nil then
error(string.format(
"Nil string: '%s'",
self:All()))
elseif peek == '{' then
return self:ReadObject()
elseif peek == '[' then
return self:ReadArray()
elseif peek == '"' then
return self:ReadString()
elseif string.find(peek, "[%+%-%d]") then
return self:ReadNumber()
elseif peek == 't' then
return self:ReadTrue()
elseif peek == 'f' then
return self:ReadFalse()
elseif peek == 'n' then
return self:ReadNull()
elseif peek == '/' then
self:ReadComment()
return self:Read()
else
return nil
end
end
function JsonReader:ReadTrue()
self:TestReservedWord{'t','r','u','e'}
return true
end
function JsonReader:ReadFalse()
self:TestReservedWord{'f','a','l','s','e'}
return false
end
function JsonReader:ReadNull()
self:TestReservedWord{'n','u','l','l'}
return nil
end
function JsonReader:TestReservedWord(t)
for i, v in ipairs(t) do
if self:Next() ~= v then
error(string.format(
"Error reading '%s': %s",
table.concat(t),
self:All()))
end
end
end
function JsonReader:ReadNumber()
local result = self:Next()
local peek = self:Peek()
while peek ~= nil and string.find(
peek,
"[%+%-%d%.eE]") do
result = result .. self:Next()
peek = self:Peek()
end
result = tonumber(result)
if result == nil then
error(string.format(
"Invalid number: '%s'",
result))
else
return result
end
end
function JsonReader:ReadString()
local result = ""
assert(self:Next() == '"')
while self:Peek() ~= '"' do
local ch = self:Next()
if ch == '\\' then
ch = self:Next()
if self.escapes[ch] then
ch = self.escapes[ch]
end
end
result = result .. ch
end
assert(self:Next() == '"')
local fromunicode = function(m)
return string.char(tonumber(m, 16))
end
return string.gsub(
result,
"u%x%x(%x%x)",
fromunicode)
end
function JsonReader:ReadComment()
assert(self:Next() == '/')
local second = self:Next()
if second == '/' then
self:ReadSingleLineComment()
elseif second == '*' then
self:ReadBlockComment()
else
error(string.format(
"Invalid comment: %s",
self:All()))
end
end
function JsonReader:ReadBlockComment()
local done = false
while not done do
local ch = self:Next()
if ch == '*' and self:Peek() == '/' then
done = true
end
if not done and
ch == '/' and
self:Peek() == "*" then
error(string.format(
"Invalid comment: %s, '/*' illegal.",
self:All()))
end
end
self:Next()
end
function JsonReader:ReadSingleLineComment()
local ch = self:Next()
while ch ~= '\r' and ch ~= '\n' do
ch = self:Next()
end
end
function JsonReader:ReadArray()
local result = {}
assert(self:Next() == '[')
local done = false
if self:Peek() == ']' then
done = true;
end
while not done do
local item = self:Read()
result[#result+1] = item
self:SkipWhiteSpace()
if self:Peek() == ']' then
done = true
end
if not done then
local ch = self:Next()
if ch ~= ',' then
error(string.format(
"Invalid array: '%s' due to: '%s'",
self:All(), ch))
end
end
end
assert(']' == self:Next())
return result
end
function JsonReader:ReadObject()
local result = {}
assert(self:Next() == '{')
local done = false
if self:Peek() == '}' then
done = true
end
while not done do
local key = self:Read()
if type(key) ~= "string" then
error(string.format(
"Invalid non-string object key: %s",
key))
end
self:SkipWhiteSpace()
local ch = self:Next()
if ch ~= ':' then
error(string.format(
"Invalid object: '%s' due to: '%s'",
self:All(),
ch))
end
self:SkipWhiteSpace()
local val = self:Read()
result[key] = val
self:SkipWhiteSpace()
if self:Peek() == '}' then
done = true
end
if not done then
ch = self:Next()
if ch ~= ',' then
error(string.format(
"Invalid array: '%s' near: '%s'",
self:All(),
ch))
end
end
end
assert(self:Next() == "}")
return result
end
function JsonReader:SkipWhiteSpace()
local p = self:Peek()
while p ~= nil and string.find(p, "[%s/]") do
if p == '/' then
self:ReadComment()
else
self:Next()
end
p = self:Peek()
end
end
function JsonReader:Peek()
return self.reader:Peek()
end
function JsonReader:Next()
return self.reader:Next()
end
function JsonReader:All()
return self.reader:All()
end
function Encode(o)
local writer = JsonWriter:New()
writer:Write(o)
return writer:ToString()
end
function Decode(s)
local reader = JsonReader:New(s)
return reader:Read()
end
function Null()
return Null
end
|
--// Bullet Physics
|
BulletPhysics = Vector3.new(0,45,0); -- Drop fixation: Lower number = more drop
BulletSpeed = 2000; -- Bullet Speed
ExploPhysics = Vector3.new(0,70,0); -- Drop for explosive rounds
ExploSpeed = 360; -- Speed for explosive rounds
|
-- goro7
|
local tweenService = game:GetService("TweenService")
function show()
-- Tween open
local goal = {
Position = UDim2.new(0, 2, 0, 2)
}
tweenService:Create(script.Parent.Clipper.Redeem, TweenInfo.new(0.25, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), goal):Play()
end
function hide()
-- Tween closed
local goal = {
Position = UDim2.new(0, -223, 0, 2)
}
tweenService:Create(script.Parent.Clipper.Redeem, TweenInfo.new(0.25, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), goal):Play()
end
script.Parent.MouseEnter:connect(show)
script.Parent.HoverArea.MouseLeave:connect(hide)
script.Parent.Parent.Shop.MouseEnter:connect(hide)
|
-- Services
|
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerStorage = game:GetService("ServerStorage")
|
--Services
|
local pathfindingService = game:GetService("PathfindingService")
local runService = game:GetService("RunService")
local modules = script.Parent
local core = require(modules.CoreModule)
local status = require(modules.Status)
local troubleshoot = require(modules.Troubleshoot)
local marine = script.Parent.Parent.Parent
local myHuman = marine.Humanoid
local myRoot = marine.HumanoidRootPart
local moveEvent = Instance.new("BindableEvent")
function movement.moveToFinished()
local success = true
local completed = false
core.spawn(function()
wait(1)
if not completed then
success = false
moveEvent:Fire()
end
end)
core.spawn(function()
myHuman.MoveToFinished:Wait()
moveEvent:Fire()
end)
moveEvent.Event:Wait()
completed = true
return success
end
local params = {
["AgentRadius"] = 2,
["AgentHeight"] = 5,
["AgentCanJump"] = true,
["WaypointSpacing"] = 4,
["Costs"] = {
["Water"] = math.huge
}
}
local path = pathfindingService:CreatePath()
function movement.pathToLocation(target)
if not target or not target.Parent then return end
path:ComputeAsync(myRoot.Position, target.Position)
if path.Status == Enum.PathStatus.NoPath then
return
end
local waypoints = path:GetWaypoints()
--Make sure that path is actually valid
if waypoints[1] and core.checkDist(waypoints[1],myRoot) > 10 then
runService.Heartbeat:Wait()
movement.pathToLocation(target)
end
troubleshoot.visualizePath(path)
for _,waypoint in ipairs(waypoints) do
if waypoint.Action == Enum.PathWaypointAction.Jump then
myHuman.Jump = true
end
myHuman:MoveTo(waypoint.Position)
core.spawn(function()
while myHuman.WalkToPoint.Y > myRoot.Position.Y - 1 do
wait(0.1)
myHuman.Jump = true
end
end)
local moveSuccess = movement.moveToFinished()
local dist = core.checkDist(myRoot,target)
local canSee = core.checkSight(target)
if not moveSuccess or not target.Parent or (dist < 30 and canSee) or status:get("currentTarget") ~= target then
break
elseif (core.checkSight(target) and target.Position.Y <= myRoot.Position.Y-5) then
myHuman:MoveTo(myRoot.Position)
break
end
if core.checkDist(target,waypoints[#waypoints]) > 30 then
--movement.pathToLocation(target)
break
end
end
end
function movement.walkRandom()
local randX = math.random(-100,100)
local randZ = math.random(-100,100)
local goal = myRoot.Position + Vector3.new(randX, 0, randZ)
local path = pathfindingService:CreatePath()
path:ComputeAsync(myRoot.Position, goal)
local waypoints = path:GetWaypoints()
if path.Status == Enum.PathStatus.Success then
for i,waypoint in ipairs(waypoints) do
if waypoint.Action == Enum.PathWaypointAction.Jump then
myHuman.Jump = true
end
myHuman:MoveTo(waypoint.Position)
core.spawn(function()
wait(0.5)
if myHuman.WalkToPoint.Y > myRoot.Position.Y then
myHuman.Jump = true
end
end)
local moveSuccess = myHuman.MoveToFinished:Wait()
if not moveSuccess or status:get("currentTarget") then
break
end
end
else
wait(2)
end
end
|
--[[Weight and CG]]
|
Tune.Weight = 4000 -- Total weight (in pounds)
Tune.WeightBSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable)
--[[Width]] 6 ,
--[[Height]] 3 ,
--[[Length]] 9 }
Tune.WeightDist = 50 -- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100)
Tune.CGHeight = .8 -- Center of gravity height (studs relative to median of all wheels)
Tune.WBVisible = false -- Makes the weight brick visible
--Unsprung Weight
Tune.FWheelDensity = .1 -- Front Wheel Density
Tune.RWheelDensity = .1 -- Rear Wheel Density
Tune.FWLgcyDensity = 1 -- Front Wheel Density [PGS OFF]
Tune.RWLgcyDensity = 1 -- Rear Wheel Density [PGS OFF]
Tune.AxleSize = 2 -- Size of structural members (larger = more stable/carry more weight)
Tune.AxleDensity = .1 -- Density of structural members
|
------//Aim Animations
|
self.RightAim = CFrame.new(-.6, 0.85, -0.5) * CFrame.Angles(math.rad(-50), math.rad(0), math.rad(0));
self.LeftAim = CFrame.new(1.6,0.6,-0.85) * CFrame.Angles(math.rad(-95),math.rad(35),math.rad(-25));
self.RightElbowAim = CFrame.new(0,-0.2,-.25) * CFrame.Angles(math.rad(-60), math.rad(0), math.rad(0));
self.LeftElbowAim = CFrame.new(0,0,0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0));
self.RightWristAim = CFrame.new(0,0,0.15) * CFrame.Angles(math.rad(20), math.rad(0), math.rad(0));
self.LeftWristAim = CFrame.new(0,0,0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0));
|
---[[ Misc Settings ]]
|
module.WhisperCommandAutoCompletePlayerNames = true
|
--------------------) Settings
|
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 20 -- cooldown for use of the tool again
ZoneModelName = "Fallen star" -- name the zone model
MobHumanoidName = "Humanoid"-- the name of player or mob u want to damage
|
--put this in workspace
--or put RealDeadSound in StarterCharacterScripts
|
local RDS = script.RealDeadSound
RDS.Parent = game.StarterPlayer.StarterCharacterScripts
RDS.Disabled = false
script:Destroy()
|
--[[END]]
--_Tune2.Horsepower.Changed:Connect(function()
-- StartEngine()
--end)
| |
-- set and keep every body part Transparency to its real transparency
|
for childIndex, child in pairs(character:GetChildren()) do
if child:IsA("BasePart") and child.Name ~= "Head" then
child:GetPropertyChangedSignal("LocalTransparencyModifier"):Connect(function()
child.LocalTransparencyModifier = child.Transparency
end)
child.LocalTransparencyModifier = child.Transparency
end
end
|
---------------------------
--[[
--Main anchor point is the DriveSeat <car.DriveSeat>
Usage:
MakeWeld(Part1,Part2,WeldType*,MotorVelocity**) *default is "Weld" **Applies to Motor welds only
ModelWeld(Model,MainPart)
Example:
MakeWeld(car.DriveSeat,misc.PassengerSeat)
MakeWeld(car.DriveSeat,misc.SteeringWheel,"Motor",.2)
ModelWeld(car.DriveSeat,misc.Door)
]]
--Weld stuff here
|
car.DriveSeat.ChildAdded:connect(function(child)
if child.Name=="SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
child.C0=CFrame.new(0,-.5,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0)
end
end)
|
---------------------------------------------------------------------
|
local PathfindingService = game:GetService("PathfindingService")
local Players = game:GetService("Players")
local function output(func, msg)
func(((func == error and "SimplePath Error: ") or "SimplePath: ")..msg)
end
local Path = {
StatusType = {
Idle = "Idle";
Active = "Active";
};
ErrorType = {
LimitReached = "LimitReached";
TargetUnreachable = "TargetUnreachable";
ComputationError = "ComputationError";
AgentStuck = "AgentStuck";
};
}
Path.__index = function(table, index)
if index == "Stopped" and not table._humanoid then
output(error, "Attempt to use Path.Stopped on a non-humanoid.")
end
return (table._events[index] and table._events[index].Event)
or (index == "LastError" and table._lastError)
or (index == "Status" and table._status)
or Path[index]
end
|
--if (script.Parent ~= nil) and (script.Parent.className == "Part") then --Work if in a block
-- connection = script.Parent.Touched:connect(onTouched)
--end
|
script.Parent.Touched:connect(onTouched)
|
--[[**
ensures Roblox RBXScriptConnection type
@param value The value to check against
@returns True iff the condition is satisfied, false otherwise
**--]]
|
t.RBXScriptConnection = primitive("RBXScriptConnection")
|
-- simple function to set the highlight of buttons
|
local function HighlightButton(button,enabled)
if not button:FindFirstChild("ButtonImage") then return end
button.ButtonImage.ImageColor3 = enabled and Color3.fromRGB(124, 124, 124) or Color3.new(1,1,1)
end
return HighlightButton
|
--[[Transmission]]
|
Tune.TransModes = {"Semi"} --[[
[Modes]
"Auto" : Automatic shifting
"Semi" : Clutchless manual shifting, dual clutch transmission
"Manual" : Manual shifting with clutch
>Include within brackets
eg: {"Semi"} or {"Auto", "Manual"}
>First mode is default mode ]]
--Automatic Settings
Tune.AutoShiftMode = "RPM" --[[
[Modes]
"Speed" : Shifts based on wheel speed
"RPM" : Shifts based on RPM ]]
Tune.AutoUpThresh = -200 --Automatic upshift point (relative to peak RPM, positive = Over-rev)
Tune.AutoDownThresh = 1400 --Automatic downshift point (relative to peak RPM, positive = Under-rev)
--Gear Ratios
Tune.FinalDrive = 4.60 -- [TRANSMISSION CALCULATIONS FOR NERDS]
Tune.Ratios = { -- SPEED [SPS] = (Wheel diameter(studs) * pi(3.14) * RPM) / (60 * Gear Ratio * Final Drive * Multiplier)
--[[Reverse]] 3.484 ,-- WHEEL TORQUE = Engine Torque * Gear Ratio * Final Drive * Multiplier
--[[Neutral]] 0 ,
--[[ 1 ]] 3.587 ,
--[[ 2 ]] 2.022 ,
--[[ 3 ]] 1.384 ,
--[[ 4 ]] 1.000 ,
--[[ 5 ]] 0.861 ,
--[[ 6 ]] 0.621 ,
}
Tune.FDMult = 1.7 -- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
|
-- Camera Shaker
-- Stephen Leitnick
-- February 26, 2018
| |
--How long after someone dies do they respawn?
|
respawn_time = .01
|
-- Weld holster model to the player
|
function HolsterWeapon(player,weaponName,toolSettings,tool)
if player.Character:FindFirstChild(toolSettings.HolsterPoint) then
local holsterPoint = toolSettings.HolsterPoint
local holsterModel = GunModels:FindFirstChild(weaponName):Clone()
holsterModel.Name = "S_"..weaponName
holsterModel.Parent = player.Character
if holsterModel:FindFirstChild("Nodes") then
holsterModel.Nodes:Destroy()
end
local config = tool:FindFirstChild("RepValues")
for _, part in pairs(holsterModel:GetChildren()) do
if part:IsA("BasePart") and part.Name ~= "Handle" then
if part.Name == "SightMark" or (part.Name == "Warhead" and config and config.Mag.Value < 1) then
part:Destroy()
else
local newWeld = Ultil.WeldComplex(holsterModel.Handle,part,part.Name)
newWeld.Parent = holsterModel.Handle
part.Anchored = false
part.CanCollide = false
end
end
end
local holsterWeld = Ultil.Weld(player.Character[holsterPoint],holsterModel.Handle,toolSettings.HolsterCFrame)
holsterWeld.Parent = holsterModel
holsterWeld.Name = "HolsterWeld"
holsterModel.Handle.Anchored = false
end
end
function SpawnGun(gunName,gunPosition,tool,player,config)
local dropModel = GunModels:FindFirstChild(gunName):Clone()
dropModel.Handle.Anchored = false
dropModel.Handle.CanTouch = true
--dropModel.Handle.CFrame = CFrame.new(dropModel["Origin Position"])
dropModel.PrimaryPart = dropModel.Handle
dropModel.Handle.Size = dropModel:GetExtentsSize()
if dropModel:FindFirstChild("Nodes") then dropModel.Nodes:Destroy() end
if #dropModel:GetChildren() < 2 then
dropModel.Handle.CanCollide = true
else
dropModel.Handle.CanCollide = false
end
for _, part in pairs(dropModel:GetChildren()) do
if part.Name == "Warhead" and config and config.IsLauncher and tool:FindFirstChild("RepValues") and tool.RepValues.Mag.Value < 1 then
part:Destroy()
elseif part:IsA("BasePart") and part.Name ~= "Handle" then
local newWeld = Ultil.WeldComplex(dropModel.Handle,part,part.Name)
newWeld.Parent = dropModel.Handle
part.Anchored = false
part.CanCollide = true
part.CanTouch = false
PhysService:SetPartCollisionGroup(part,"Guns")
end
end
if not tool then
tool = Engine.ToolStorage:FindFirstChild(gunName):Clone()
end
tool.Parent = dropModel
local clickDetector = Instance.new("ClickDetector")
clickDetector.MaxActivationDistance = gameRules.PickupDistance
clickDetector.Parent = dropModel
clickDetector.MouseClick:Connect(function(clicker)
tool.Parent = clicker.Backpack
dropModel:Destroy()
local NewSound = Engine.FX.WeaponPickup:Clone()
NewSound.Parent = clicker.Character.Torso
--NewSound.PlaybackSpeed = math.random(30,50)/40
NewSound:Play()
NewSound.PlayOnRemove = true
NewSound:Destroy()
end)
dropModel.Parent = ACS_Workspace.DroppedGuns
dropModel.Handle.Touched:Connect(function()
if dropModel.Handle.AssemblyLinearVelocity.Magnitude > 7 then
local DropSounds = Engine.FX.GunDrop
local NewSound = DropSounds["GunDrop"..math.random(#DropSounds:GetChildren())]:Clone()
NewSound.Parent = dropModel.Handle
NewSound.PlaybackSpeed = math.random(30,50)/40
NewSound:Play()
NewSound.PlayOnRemove = true
NewSound:Destroy()
end
end)
if player then dropModel.Handle:SetNetworkOwner(player) end
dropModel:SetPrimaryPartCFrame(gunPosition)
if #ACS_Workspace.DroppedGuns:GetChildren() > gameRules.MaxDroppedWeapons then
ACS_Workspace.DroppedGuns:GetChildren()[1]:Destroy()
end
if gameRules.TimeDespawn then
Debris:AddItem(dropModel,gameRules.WeaponDespawnTime)
end
return dropModel
end
Evt.Shell.OnServerEvent:Connect(function(Player,Shell,Origin)
Evt.Shell:FireAllClients(Shell,Origin)
end)
Evt.DropWeapon.OnServerEvent:Connect(function(player,tool,toolConfig)
local tool = player.Backpack:FindFirstChild(tool.Name)
--print(player.Name.. " dropped a " ..tool.Name)
--tool:Destroy()
local NewSound = Engine.FX.WeaponDrop:Clone()
NewSound.Parent = player.Character.Torso
--NewSound.PlaybackSpeed = math.random(30,50)/40
NewSound:Play()
NewSound.PlayOnRemove = true
NewSound:Destroy()
SpawnGun(tool.Name,player.Character.Torso.CFrame * CFrame.new(0,1,-3),tool,player,toolConfig)
end)
Evt.RepAmmo.OnServerEvent:Connect(function(Player,tool,mag,ammo,chambered)
local config = tool.RepValues
config.StoredAmmo.Value = ammo
config.Mag.Value = mag
config.Chambered.Value = chambered
if tool.Parent:FindFirstChild("Humanoid") and tool.Parent:FindFirstChild("S"..tool.Name) then
-- Tool is equipped
for _, part in pairs(tool.Parent["S"..tool.Name]:GetChildren()) do
if part.Name == "Warhead" then
if mag > 0 then
part.Transparency = 0
else
part.Transparency = 1
end
end
end
end
end)
Evt.DropAmmo.OnServerEvent:Connect(function(Player,tool,action)
if action == "Weld" then
local canModel = Engine.AmmoModels.AmmoBox:Clone()
local handle = tool.Handle
for _, part in pairs(canModel:GetChildren()) do
if part:IsA("BasePart") and part.Name ~= "Main" then
local newWeld = Ultil.WeldComplex(canModel.Main,part,part.Name)
newWeld.Parent = canModel.Main
part.Anchored = false
part.CanCollide = true
part.CanTouch = false
end
PhysService:SetPartCollisionGroup(part,"Guns")
if part.Name == "Main" then
for _, child in pairs(part:GetChildren()) do
if child:FindFirstChildWhichIsA("TextLabel") then
child:FindFirstChildWhichIsA("TextLabel").Text = tool.AmmoType.Value
end
end
end
end
local newWeld = Ultil.Weld(handle,canModel.Main,CFrame.new(0,-0.2,0),CFrame.new())
newWeld.Name = "ToolWeld"
newWeld.Parent = handle
canModel.Main.Anchored = false
handle.Anchored = false
canModel.Parent = tool
elseif action == "Destroy" then
if tool:FindFirstChildWhichIsA("Model") then
tool:FindFirstChildWhichIsA("Model"):Destroy()
tool.Handle.ToolWeld:Destroy()
end
elseif action == "Drop" then
local canModel = tool:FindFirstChildWhichIsA("Model")
local handle = tool.Handle
handle.ToolWeld:Destroy()
canModel.Parent = ACS_Workspace.DroppedGuns
canModel.Main.Touched:Connect(function(hitPart)
if plr:GetPlayerFromCharacter(hitPart.Parent) then
local player = plr:GetPlayerFromCharacter(hitPart.Parent)
local f = player.Backpack:GetChildren()
for i = 1, #f do
if f[i]:IsA("Tool") and f[i]:FindFirstChild("ACS_Settings") then
if tool.AmmoType.Value == "Universal" then
Evt.Refil:FireClient(player, f[i], tool.Inf.Value, tool.Stored)
if not canModel.Main.Sound.Playing then
canModel.Main.Sound:Play()
end
elseif require(f[i].ACS_Settings).BulletType == tool.AmmoType.Value then
Evt.Refil:FireClient(player, f[i], tool.Inf.Value, tool.Stored)
if not canModel.Main.Sound.Playing then
canModel.Main.Sound:Play()
end
end
end
end
-- No more ammo
if tool.Stored.Value <= 0 and not tool.Inf.Value then
canModel:Destroy()
tool:Destroy()
return
end
end
end)
tool.Parent = nil
local clicker = Instance.new("ClickDetector",canModel)
clicker.MaxActivationDistance = gameRules.PickupDistance
clicker.MouseClick:Connect(function(Player)
--print("Give")
tool.Parent = Player:WaitForChild("Backpack")
canModel:Destroy()
end)
Debris:AddItem(canModel, gameRules.AmmoBoxDespawn)
end
end)
for _, spawner in pairs(ACS_Workspace.WeaponSpawners:GetChildren()) do
local constrainedValue = Instance.new("DoubleConstrainedValue")
local maxTime = spawner.Config.WaitTime
constrainedValue.Name = "WaitTime"
constrainedValue.MaxValue = maxTime.Value
constrainedValue.Value = maxTime.Value
constrainedValue.Parent = spawner.Config
maxTime:Destroy()
end
|
--[[**
<description>
Asynchronously saves the data to the data store.
</description>
**--]]
|
function DataStore:SaveAsync()
return Promise.async(function(resolve, reject)
if not self.valueUpdated then
warn(("Data store %s was not saved as it was not updated."):format(self.Name))
resolve(false)
return
end
if RunService:IsStudio() and not SaveInStudio then
warn(("Data store %s attempted to save in studio while SaveInStudio is false."):format(self.Name))
if not SaveInStudioObject then
warn("You can set the value of this by creating a BoolValue named SaveInStudio in ServerStorage.")
end
resolve(false)
return
end
if self.backup then
warn("This data store is a backup store, and thus will not be saved.")
resolve(false)
return
end
if self.value ~= nil then
local save = clone(self.value)
if self.beforeSave then
local success, result = pcall(self.beforeSave, save, self)
if success then
save = result
else
reject(result, Constants.SaveFailure.BeforeSaveError)
return
end
end
local problem = Verifier.testValidity(save)
if problem then
reject(problem, Constants.SaveFailure.InvalidData)
return
end
return self.savingMethod:Set(save):andThen(function()
resolve(true, save)
end)
end
end):andThen(function(saved, save)
if saved then
for _, afterSave in ipairs(self.afterSave) do
local success, err = pcall(afterSave, save, self)
if not success then
warn("Error on AfterSave:", err)
end
end
self.valueUpdated = false
end
end)
end
function DataStore:BindToClose(callback)
table.insert(self.bindToClose, callback)
end
function DataStore:GetKeyValue(key)
return (self.value or {})[key]
end
function DataStore:SetKeyValue(key, newValue)
if not self.value then
self.value = self:Get({})
end
self.value[key] = newValue
end
local CombinedDataStore = {}
do
function CombinedDataStore:BeforeInitialGet(modifier)
self.combinedBeforeInitialGet = modifier
end
function CombinedDataStore:BeforeSave(modifier)
self.combinedBeforeSave = modifier
end
function CombinedDataStore:Get(defaultValue, dontAttemptGet)
local tableResult = self.combinedStore:Get({})
local tableValue = tableResult[self.combinedName]
if not dontAttemptGet then
if tableValue == nil then
tableValue = defaultValue
else
if self.combinedBeforeInitialGet and not self.combinedInitialGot then
tableValue = self.combinedBeforeInitialGet(tableValue)
end
end
end
self.combinedInitialGot = true
tableResult[self.combinedName] = clone(tableValue)
self.combinedStore:Set(tableResult, true)
return clone(tableValue)
end
function CombinedDataStore:Set(value, dontCallOnUpdate)
return self.combinedStore:GetAsync({}):andThen(function(tableResult)
tableResult[self.combinedName] = value
self.combinedStore:Set(tableResult, dontCallOnUpdate)
self:_Update(dontCallOnUpdate)
end)
end
function CombinedDataStore:Update(updateFunc)
self:Set(updateFunc(self:Get()))
end
function CombinedDataStore:Save()
self.combinedStore:Save()
end
function CombinedDataStore:OnUpdate(callback)
if not self.onUpdateCallbacks then
self.onUpdateCallbacks = {callback}
else
table.insert(self.onUpdateCallbacks, callback)
end
end
function CombinedDataStore:_Update(dontCallOnUpdate)
if not dontCallOnUpdate then
for _, callback in ipairs(self.onUpdateCallbacks or {}) do
callback(self:Get(), self)
end
end
self.combinedStore:_Update(true)
end
function CombinedDataStore:SetBackup(retries)
self.combinedStore:SetBackup(retries)
end
end
local DataStoreMetatable = {}
DataStoreMetatable.__index = DataStore
|
--Wheels--
|
local WMRR = Instance.new("Attachment",zBRL)
WMRR.Rotation = Vector3.new(0,0,0)
WMRR.Name = "Wheel"
local WMLL = Instance.new("Attachment",zBRR)
WMLL.Rotation = Vector3.new(0,0,0)
WMLL.Name = "Wheel"
|
-- A function to play fire sounds.
|
function PlayFireSound()
local NewSound = FireSound:Clone()
NewSound.Parent = Handle
NewSound:Play()
Debris:AddItem(NewSound, NewSound.TimeLength)
end
function PlayLandSound(position)
local attachment = Instance.new("Attachment")
attachment.CFrame = CFrame.new(position)
local NewSound = LandSound:Clone()
NewSound.Parent = attachment
attachment.Parent = workspace.Terrain
NewSound:Play()
Debris:AddItem(NewSound, NewSound.TimeLength)
end
|
-- Services
|
local tweenService = game:GetService("TweenService")
|
-- Delete default running sound
|
character.HumanoidRootPart:FindFirstChild("Running"):Destroy()
|
--[=[
@param parent Instance
@param namespace string?
@return ServerComm
Constructs a ServerComm object. The `namespace` parameter is used
in cases where more than one ServerComm object may be bound
to the same object. Otherwise, a default namespace is used.
```lua
local serverComm = ServerComm.new(game:GetService("ReplicatedStorage"))
-- If many might exist in the given parent, use a unique namespace:
local serverComm = ServerComm.new(game:GetService("ReplicatedStorage"), "MyNamespace")
```
]=]
|
function ServerComm.new(parent: Instance, namespace: string?)
assert(Util.IsServer, "ServerComm must be constructed from the server")
assert(typeof(parent) == "Instance", "Parent must be of type Instance")
local ns = Util.DefaultCommFolderName
if namespace then
ns = namespace
end
assert(not parent:FindFirstChild(ns), "Parent already has another ServerComm bound to namespace " .. ns)
local self = setmetatable({}, ServerComm)
self._instancesFolder = Instance.new("Folder")
self._instancesFolder.Name = ns
self._instancesFolder.Parent = parent
return self
end
|
------------------------------|分割线|------------------------------
|
function BezierCurve.LinearBezierCurvesLookAt(Frame , FPS , Target , Position1 , Position2 , CFrameOffset)
local CFramePart = Instance.new("Part")
CFramePart.Parent = Target
CFramePart.Transparency = 1
CFramePart.Size = Vector3.new(1,1,1)
CFramePart.Anchored = true
CFramePart.CanCollide = false
if typeof(Position1) ~= "Vector3" then
Position1 = Position1.Position
end
if typeof(Position2) ~= "Vector3" then
Position2 = Position2.Position
end
for Index = 0 , Frame , 1 do
local Time = Index / Frame
CFramePart.Position = BezierCurve.Lerp(Position1 , Position2 , Time)
if Index == 0 then
continue
else
Target.CFrame = CFrame.lookAt(Target.Position , CFramePart.Position , Vector3.new(0,1,0)) * CFrameOffset
Target.Position = CFramePart.Position
end
task.wait(1 / FPS)
end
Debris:AddItem(CFramePart , task.wait())
end
function BezierCurve.QuadraticBezierCurvesLookAt(Frame , FPS , Target , Position1 , Position2 , Position3 , CFrameOffset)
local CFramePart = Instance.new("Part")
CFramePart.Parent = Target
CFramePart.Transparency = 1
CFramePart.Size = Vector3.new(1,1,1)
CFramePart.Anchored = true
CFramePart.CanCollide = false
if typeof(Position1) ~= "Vector3" then
Position1 = Position1.Position
end
if typeof(Position2) ~= "Vector3" then
Position2 = Position2.Position
end
if typeof(Position3) ~= "Vector3" then
Position3 = Position3.Position
end
for Index = 0 , Frame , 1 do
local Time = Index / Frame
local Lerp1 = BezierCurve.Lerp(Position1 , Position2 , Time)
local Lerp2 = BezierCurve.Lerp(Position2 , Position3 , Time)
CFramePart.Position = BezierCurve.Lerp(Lerp1 , Lerp2 , Time)
if Index == 0 then
continue
else
Target.CFrame = CFrame.lookAt(Target.Position , CFramePart.Position , Vector3.new(0,1,0)) * CFrameOffset
Target.Position = CFramePart.Position
end
task.wait(1 / FPS)
end
Debris:AddItem(CFramePart , task.wait())
end
function BezierCurve.CubicBezierCurvesLookAt(Frame , FPS , Target , Position1 , Position2 , Position3 , Position4 , CFrameOffset)
local CFramePart = Instance.new("Part")
CFramePart.Parent = Target
CFramePart.Transparency = 1
CFramePart.Size = Vector3.new(1,1,1)
CFramePart.Anchored = true
CFramePart.CanCollide = false
if typeof(Position1) ~= "Vector3" then
Position1 = Position1.Position
end
if typeof(Position2) ~= "Vector3" then
Position2 = Position2.Position
end
if typeof(Position3) ~= "Vector3" then
Position3 = Position3.Position
end
if typeof(Position4) ~= "Vector3" then
Position4 = Position4.Position
end
for Index = 0 , Frame , 1 do
local Time = Index / Frame
local Lerp1 = BezierCurve.Lerp(Position1 , Position2 , Time)
local Lerp2 = BezierCurve.Lerp(Position2 , Position3 , Time)
local Lerp3 = BezierCurve.Lerp(Position3 , Position4 , Time)
local InLerp1 = BezierCurve.Lerp(Lerp1 , Lerp2 , Time)
local InLerp2 = BezierCurve.Lerp(Lerp2 , Lerp3 , Time)
CFramePart.Position = BezierCurve.Lerp(InLerp1 , InLerp2 , Time)
if Index == 0 then
continue
else
Target.CFrame = CFrame.lookAt(Target.Position , CFramePart.Position , Vector3.new(0,1,0)) * CFrameOffset
Target.Position = CFramePart.Position
end
task.wait(1 / FPS)
end
Debris:AddItem(CFramePart , task.wait())
end
return BezierCurve
|
----------------------------------------------------------------------------------------------------
-----------------=[ RECOIL & PRECISAO ]=------------------------------------------------------------
----------------------------------------------------------------------------------------------------
|
,VRecoil = {7,13} --- Vertical Recoil
,HRecoil = {4,8} --- Horizontal Recoil
,AimRecover = 1 ---- Between 0 & 1
,RecoilPunch = .25
,VPunchBase = 5.5 --- Vertical Punch
,HPunchBase = 2 --- Horizontal Punch
,DPunchBase = 1 --- Tilt Punch | useless
,AimRecoilReduction = 1 --- Recoil Reduction Factor While Aiming (Do not set to 0)
,PunchRecover = 0.2
,MinRecoilPower = 1
,MaxRecoilPower = 3
,RecoilPowerStepAmount = .5
,MinSpread = 3 --- Min bullet spread value | Studs
,MaxSpread = 40 --- Max bullet spread value | Studs
,AimInaccuracyStepAmount = 2.5
,WalkMultiplier = 0 --- Bullet spread based on player speed
,SwayBase = 0.25 --- Weapon Base Sway | Studs
,MaxSway = 1 --- Max sway value based on player stamina | Studs
|
-- See if already listed
|
local listed = false
for _, i in pairs(plr.PlayerGui.MainGui.RadioSettings.History.Container:GetChildren()) do
if i.Name == "Entry" then
if i.ID.Value == script.Parent.ID.Value then
listed = true
break
end
end
end
if listed then
-- Gray out add button
script.Parent.AddButton.TextColor3 = Color3.fromRGB(100, 100, 100)
end
|
-- A CFrame that's really far away. Ideally. You are free to change this as needed.
|
local CF_REALLY_FAR_AWAY = CFrame.new(0, 10e8, 0)
|
------Fix network issues------
|
pcall(function()
while marine.HumanoidRootPart:GetNetworkOwnershipAuto() do
marine.HumanoidRootPart:SetNetworkOwner(nil)
wait()
end
end)
|
--//Services//--
|
local RunService = game:GetService("RunService")
|
--[=[
Wraps TeleportService:ReserveServer(placeId)
@param placeId number
@return Promise<string> -- Code
]=]
|
function TeleportServiceUtils.promiseReserveServer(placeId)
assert(type(placeId) == "number", "Bad placeId")
return Promise.spawn(function(resolve, reject)
local accessCode
local ok, err = pcall(function()
accessCode = TeleportService:ReserveServer(placeId)
end)
if not ok then
return reject(err)
end
return resolve(accessCode)
end)
end
|
--// Ammo Settings
|
Ammo = 30;
StoredAmmo = 30;
MagCount = math.huge; -- If you want infinate ammo, set to math.huge EX. MagCount = math.huge;
ExplosiveAmmo = 3;
|
--[[
VRBaseCamera - Base class for VR camera
2021 Roblox VR
--]]
| |
--[=[
Initializes the PlayerDataStoreService. Should be done via [ServiceBag.Init].
@param serviceBag ServiceBag
]=]
|
function PlayerDataStoreService:Init(serviceBag)
self._serviceBag = assert(serviceBag, "No serviceBag")
self._maid = Maid.new()
self._started = Promise.new()
self._maid:GiveTask(self._started)
self._dataStoreName = "PlayerData"
self._dataStoreScope = "SaveData"
end
|
---
|
if script.Parent.Parent.Parent.IsOn.Value then
script.Parent.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,2,true)
end
script.Parent.Parent.Parent.IsOn.Changed:connect(function()
if script.Parent.Parent.Parent.IsOn.Value then
script.Parent.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,2,true)
end
end)
function turn()
if hinge.DesiredAngle == 0 then
car.Misc.Wiper.WiperEvent:FireServer(1)
else
car.Misc.Wiper.WiperEvent:FireServer(0)
end
end
script.Parent.MouseButton1Click:connect(function()
turn()
end)
local uis = game:GetService("UserInputService")
uis.InputBegan:connect(function(i,f)
if not f then
if i.KeyCode == Enum.KeyCode.N then
turn()
end
end
end)
|
---Size
|
local FSX = Frame.Size.X.Scale
local FSY = Frame.Size.Y.Scale
Player.DataFolder.Gems.Changed:Connect(function()
StatTrack.Text = Gems.Value
local function GoBack()
Frame:TweenSize(
UDim2.new(FSX,0,FSY,0),
Enum.EasingDirection.Out,
Enum.EasingStyle.Back,
0.125,
true
)
end
Frame:TweenSize(
UDim2.new(FSX + 0.019 ,0,FSY + 0.019,0),
Enum.EasingDirection.Out,
Enum.EasingStyle.Back,
0.125,
true,
GoBack
)
end)
|
--[[**
ensures Roblox Random type
@param value The value to check against
@returns True iff the condition is satisfied, false otherwise
**--]]
|
t.Random = primitive("Random")
|
--Made by Luckymaxer
|
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Light = Handle:WaitForChild("Light")
Players = game:GetService("Players")
Debris = game:GetService("Debris")
CastLaser = Tool:WaitForChild("CastLaser"):Clone()
Modules = Tool:WaitForChild("Modules")
Functions = require(Modules:WaitForChild("Functions"))
BaseUrl = "http://www.roblox.com/asset/?id="
ConfigurationBin = Tool:WaitForChild("Configuration")
Configuration = {}
Configuration = Functions.CreateConfiguration(ConfigurationBin, Configuration)
ToolEquipped = false
Remotes = Tool:WaitForChild("Remotes")
Sounds = {
Fire = Handle:WaitForChild("Fire"),
}
BasePart = Instance.new("Part")
BasePart.Shape = Enum.PartType.Block
BasePart.Material = Enum.Material.Plastic
BasePart.TopSurface = Enum.SurfaceType.Smooth
BasePart.BottomSurface = Enum.SurfaceType.Smooth
BasePart.FormFactor = Enum.FormFactor.Custom
BasePart.Size = Vector3.new(0.2, 0.2, 0.2)
BasePart.CanCollide = true
BasePart.Locked = true
BasePart.Anchored = false
BaseRay = BasePart:Clone()
BaseRay.Name = "Ray"
BaseRay.BrickColor = BrickColor.new("New Yeller")
BaseRay.Material = Enum.Material.SmoothPlastic
BaseRay.Size = Vector3.new(0.2, 0.2, 0.2)
BaseRay.Anchored = true
BaseRay.CanCollide = false
BaseRayMesh = Instance.new("SpecialMesh")
BaseRayMesh.Name = "Mesh"
BaseRayMesh.MeshType = Enum.MeshType.Brick
BaseRayMesh.Scale = Vector3.new(0.2, 0.2, 1)
BaseRayMesh.Offset = Vector3.new(0, 0, 0)
BaseRayMesh.VertexColor = Vector3.new(1, 1, 1)
BaseRayMesh.Parent = BaseRay
ServerControl = (Remotes:FindFirstChild("ServerControl") or Instance.new("RemoteFunction"))
ServerControl.Name = "ServerControl"
ServerControl.Parent = Remotes
ClientControl = (Remotes:FindFirstChild("ClientControl") or Instance.new("RemoteFunction"))
ClientControl.Name = "ClientControl"
ClientControl.Parent = Remotes
Light.Enabled = false
Tool.Enabled = true
function RayTouched(Hit, Position)
if not Hit or not Hit.Parent then
return
end
local character = Hit.Parent
if character:IsA("Hat") then
character = character.Parent
end
if character == Character then
return
end
local humanoid = character:FindFirstChild("Humanoid")
if not humanoid or humanoid.Health == 0 then
return
end
local player = Players:GetPlayerFromCharacter(character)
if player and Functions.IsTeamMate(Player, player) then
return
end
local DeterminedDamage = math.random(Configuration.Damage.MinValue, Configuration.Damage.MaxValue)
Functions.UntagHumanoid(humanoid)
Functions.TagHumanoid(humanoid, Player)
humanoid:TakeDamage(DeterminedDamage)
end
function CheckIfAlive()
return (((Player and Player.Parent and Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0) and true) or false)
end
function Equipped()
Character = Tool.Parent
Player = Players:GetPlayerFromCharacter(Character)
Humanoid = Character:FindFirstChild("Humanoid")
if not CheckIfAlive() then
return
end
ToolEquipped = true
end
function Unequipped()
ToolEquipped = false
end
function InvokeClient(Mode, Value)
local ClientReturn = nil
pcall(function()
ClientReturn = ClientControl:InvokeClient(Player, Mode, Value)
end)
return ClientReturn
end
ServerControl.OnServerInvoke = (function(player, Mode, Value)
if player ~= Player or not ToolEquipped or not CheckIfAlive() or not Mode or not Value then
return
end
if Mode == "Fire" then
Sounds.Fire:Play()
elseif Mode == "RayHit" then
local RayHit = Value.Hit
local RayPosition = Value.Position
if RayHit and RayPosition then
RayTouched(RayHit, RayPosition)
end
Light.Color = BaseRay.BrickColor.Color
if not Light.Enabled then
Light.Enabled = true
Delay(0.1, function()
Light.Enabled = false
end)
end
elseif Mode == "CastLaser" then
local StartPosition = Value.StartPosition
local TargetPosition = Value.TargetPosition
local RayHit = Value.RayHit
if not StartPosition or not TargetPosition or not RayHit then
return
end
for i, v in pairs(Players:GetPlayers()) do
if v:IsA("Player") and v ~= Player then
local Backpack = v:FindFirstChild("Backpack")
if Backpack then
local LaserScript = CastLaser:Clone()
local StartPos = Instance.new("Vector3Value")
StartPos.Name = "StartPosition"
StartPos.Value = StartPosition
StartPos.Parent = LaserScript
local TargetPos = Instance.new("Vector3Value")
TargetPos.Name = "TargetPosition"
TargetPos.Value = TargetPosition
TargetPos.Parent = LaserScript
local RayHit = Instance.new("BoolValue")
RayHit.Name = "RayHit"
RayHit.Value = RayHit
RayHit.Parent = LaserScript
LaserScript.Disabled = false
Debris:AddItem(LaserScript, 1.5)
LaserScript.Parent = Backpack
end
end
end
end
end)
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
|
--Set up WeaponTypes lookup table
|
do
local function onNewWeaponType(weaponTypeModule)
if not weaponTypeModule:IsA("ModuleScript") then
return
end
local weaponTypeName = weaponTypeModule.Name
xpcall(function()
coroutine.wrap(function()
local weaponType = require(weaponTypeModule)
assert(typeof(weaponType) == "table", string.format("WeaponType \"%s\" did not return a valid table", weaponTypeModule:GetFullName()))
WEAPON_TYPES_LOOKUP[weaponTypeName] = weaponType
end)()
end, function(errMsg)
warn(string.format("Error while loading %s: %s", weaponTypeModule:GetFullName(), errMsg))
warn(debug.traceback())
end)
end
for _, child in pairs(WeaponTypes:GetChildren()) do
onNewWeaponType(child)
end
WeaponTypes.ChildAdded:Connect(onNewWeaponType)
end
local WeaponsSystem = {}
WeaponsSystem.didSetup = false
WeaponsSystem.knownWeapons = {}
WeaponsSystem.connections = {}
WeaponsSystem.networkFolder = nil
WeaponsSystem.remoteEvents = {}
WeaponsSystem.remoteFunctions = {}
WeaponsSystem.currentWeapon = nil
WeaponsSystem.aimRayCallback = nil
WeaponsSystem.CurrentWeaponChanged = Instance.new("BindableEvent")
local NetworkingCallbacks = require(WeaponsSystemFolder:WaitForChild("NetworkingCallbacks"))
NetworkingCallbacks.WeaponsSystem = WeaponsSystem
local _damageCallback = nil
local _getTeamCallback = nil
function WeaponsSystem.setDamageCallback(cb)
_damageCallback = cb
end
function WeaponsSystem.setGetTeamCallback(cb)
_getTeamCallback = cb
end
function WeaponsSystem.setup()
if WeaponsSystem.didSetup then
warn("Warning: trying to run WeaponsSystem setup twice on the same module.")
return
end
print(script.Parent:GetFullName(), "is now active.")
WeaponsSystem.doingSetup = true
--Setup network routing
if IsServer then
local networkFolder = Instance.new("Folder")
networkFolder.Name = "Network"
for _, remoteEventName in pairs(REMOTE_EVENT_NAMES) do
local remoteEvent = Instance.new("RemoteEvent")
remoteEvent.Name = remoteEventName
remoteEvent.Parent = networkFolder
local callback = NetworkingCallbacks[remoteEventName]
if not callback then
--Connect a no-op function to ensure the queue doesn't pile up.
warn("There is no server callback implemented for the WeaponsSystem RemoteEvent \"%s\"!")
warn("A default no-op function will be implemented so that the queue cannot be abused.")
callback = function() end
end
WeaponsSystem.connections[remoteEventName .. "Remote"] = remoteEvent.OnServerEvent:Connect(function(...)
callback(...)
end)
WeaponsSystem.remoteEvents[remoteEventName] = remoteEvent
end
for _, remoteFuncName in pairs(REMOTE_FUNCTION_NAMES) do
local remoteFunc = Instance.new("RemoteEvent")
remoteFunc.Name = remoteFuncName
remoteFunc.Parent = networkFolder
local callback = NetworkingCallbacks[remoteFuncName]
if not callback then
--Connect a no-op function to ensure the queue doesn't pile up.
warn("There is no server callback implemented for the WeaponsSystem RemoteFunction \"%s\"!")
warn("A default no-op function will be implemented so that the queue cannot be abused.")
callback = function() end
end
remoteFunc.OnServerInvoke = function(...)
return callback(...)
end
WeaponsSystem.remoteFunctions[remoteFuncName] = remoteFunc
end
networkFolder.Parent = WeaponsSystemFolder
WeaponsSystem.networkFolder = networkFolder
else
WeaponsSystem.StarterGui = game:GetService("StarterGui")
WeaponsSystem.camera = ShoulderCamera.new(WeaponsSystem)
WeaponsSystem.gui = WeaponsGui.new(WeaponsSystem)
if ConfigurationValues.SprintEnabled.Value then
WeaponsSystem.camera:setSprintEnabled(ConfigurationValues.SprintEnabled.Value)
end
if ConfigurationValues.SlowZoomWalkEnabled.Value then
WeaponsSystem.camera:setSlowZoomWalkEnabled(ConfigurationValues.SlowZoomWalkEnabled.Value)
end
local networkFolder = WeaponsSystemFolder:WaitForChild("Network", math.huge)
for _, remoteEventName in pairs(REMOTE_EVENT_NAMES) do
coroutine.wrap(function()
local remoteEvent = networkFolder:WaitForChild(remoteEventName, math.huge)
local callback = NetworkingCallbacks[remoteEventName]
if callback then
WeaponsSystem.connections[remoteEventName .. "Remote"] = remoteEvent.OnClientEvent:Connect(function(...)
callback(...)
end)
end
WeaponsSystem.remoteEvents[remoteEventName] = remoteEvent
end)()
end
for _, remoteFuncName in pairs(REMOTE_FUNCTION_NAMES) do
coroutine.wrap(function()
local remoteFunc = networkFolder:WaitForChild(remoteFuncName, math.huge)
local callback = NetworkingCallbacks[remoteFuncName]
if callback then
remoteFunc.OnClientInvoke = function(...)
return callback(...)
end
end
WeaponsSystem.remoteFunctions[remoteFuncName] = remoteFunc
end)()
end
Players.LocalPlayer.CharacterAdded:Connect(WeaponsSystem.onCharacterAdded)
if Players.LocalPlayer.Character then
WeaponsSystem.onCharacterAdded(Players.LocalPlayer.Character)
end
WeaponsSystem.networkFolder = networkFolder
--WeaponsSystem.camera:setEnabled(true)
end
--Setup weapon tools and listening
WeaponsSystem.connections.weaponAdded = CollectionService:GetInstanceAddedSignal(WEAPON_TAG):Connect(WeaponsSystem.onWeaponAdded)
WeaponsSystem.connections.weaponRemoved = CollectionService:GetInstanceRemovedSignal(WEAPON_TAG):Connect(WeaponsSystem.onWeaponRemoved)
for _, instance in pairs(CollectionService:GetTagged(WEAPON_TAG)) do
WeaponsSystem.onWeaponAdded(instance)
end
WeaponsSystem.doingSetup = false
WeaponsSystem.didSetup = true
end
function WeaponsSystem.onCharacterAdded(character)
-- Make it so players unequip weapons while seated, then reequip weapons when they become unseated
local humanoid = character:WaitForChild("Humanoid")
WeaponsSystem.connections.seated = humanoid.Seated:Connect(function(isSeated)
if isSeated then
WeaponsSystem.seatedWeapon = character:FindFirstChildOfClass("Tool")
humanoid:UnequipTools()
WeaponsSystem.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
else
WeaponsSystem.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true)
humanoid:EquipTool(WeaponsSystem.seatedWeapon)
end
end)
end
function WeaponsSystem.shutdown()
if not WeaponsSystem.didSetup then
return
end
for _, weapon in pairs(WeaponsSystem.knownWeapons) do
weapon:onDestroyed()
end
WeaponsSystem.knownWeapons = {}
if IsServer and WeaponsSystem.networkFolder then
WeaponsSystem.networkFolder:Destroy()
end
WeaponsSystem.networkFolder = nil
WeaponsSystem.remoteEvents = {}
WeaponsSystem.remoteFunctions = {}
for _, connection in pairs(WeaponsSystem.connections) do
if typeof(connection) == "RBXScriptConnection" then
connection:Disconnect()
end
end
WeaponsSystem.connections = {}
end
function WeaponsSystem.getWeaponTypeFromTags(instance)
for _, tag in pairs(CollectionService:GetTags(instance)) do
local weaponTypeFound = WEAPON_TYPES_LOOKUP[tag]
if weaponTypeFound then
return weaponTypeFound
end
end
return nil
end
function WeaponsSystem.createWeaponForInstance(weaponInstance)
coroutine.wrap(function()
local weaponType = WeaponsSystem.getWeaponTypeFromTags(weaponInstance)
if not weaponType then
local weaponTypeObj = weaponInstance:WaitForChild("WeaponType")
if weaponTypeObj and weaponTypeObj:IsA("StringValue") then
local weaponTypeName = weaponTypeObj.Value
local weaponTypeFound = WEAPON_TYPES_LOOKUP[weaponTypeName]
if not weaponTypeFound then
warn(string.format("Cannot find the weapon type \"%s\" for the instance %s!", weaponTypeName, weaponInstance:GetFullName()))
return
end
weaponType = weaponTypeFound
else
warn("Could not find a WeaponType tag or StringValue for the instance ", weaponInstance:GetFullName())
return
end
end
-- Since we might have yielded while trying to get the WeaponType, we need to make sure not to continue
-- making a new weapon if something else beat this iteration.
if WeaponsSystem.getWeaponForInstance(weaponInstance) then
warn("Already got ", weaponInstance:GetFullName())
warn(debug.traceback())
return
end
-- We should be pretty sure we got a valid weaponType by now
assert(weaponType, "Got invalid weaponType")
local weapon = weaponType.new(WeaponsSystem, weaponInstance)
WeaponsSystem.knownWeapons[weaponInstance] = weapon
end)()
end
function WeaponsSystem.getWeaponForInstance(weaponInstance)
if not typeof(weaponInstance) == "Instance" then
warn("WeaponsSystem.getWeaponForInstance(weaponInstance): 'weaponInstance' was not an instance.")
return nil
end
return WeaponsSystem.knownWeapons[weaponInstance]
end
|
--[[Engine]]
|
--Torque Curve
Tune.Horsepower = 480 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 6000 -- Use sliders to manipulate values
Tune.Redline = 6700 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 5500
Tune.PeakSharpness = 7.5
Tune.CurveMult = 0.16
--Incline Compensation
Tune.InclineComp = 1.7 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 150 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response)
|
-- Roblox character sound script
|
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local SOUND_DATA = {
Climbing = {
SoundId = "rbxasset://sounds/bfsl-minifigfoots1.mp3",
Looped = true,
},
Died = {
SoundId = "rbxasset://sounds/uuhhh.mp3",
},
FreeFalling = {
SoundId = "rbxasset://sounds/swoosh.wav",
Looped = true,
},
GettingUp = {
SoundId = "rbxasset://sounds/hit.wav",
},
Jumping = {
SoundId = "rbxasset://sounds/button.wav",
},
Landing = {
SoundId = "rbxasset://sounds/splat.wav",
},
Running = {
SoundId = "rbxasset://sounds/bfsl-minifigfoots1.mp3",
Looped = true,
Pitch = 1,
},
Splash = {
SoundId = "rbxasset://sounds/impact_water.mp3",
},
Swimming = {
SoundId = "rbxasset://sounds/action_swim.mp3",
Looped = true,
Pitch = 1.6,
},
}
-- wait for the first of the passed signals to fire
local function waitForFirst(...)
local shunt = Instance.new("BindableEvent")
local slots = {...}
local function fire(...)
for i = 1, #slots do
slots[i]:Disconnect()
end
return shunt:Fire(...)
end
for i = 1, #slots do
slots[i] = slots[i]:Connect(fire)
end
return shunt.Event:Wait()
end
|
-- Tags --
|
local pantsId = script.Parent.Parent.Coathanger.Pants.PantsTemplate
local shirtId = script.Parent.Parent.Coathanger.Shirt.ShirtTemplate
local cPart = script.Parent
local cDetector = script.Parent.ClickDetector
|
-- redirect
|
destination =( (root.CFrame*CFrame.Angles(0,math.rad(math.random(90,270)),0))*CFrame.new(0,0,-40)).p
holdOrder = tick()
elseif part == workspace.Terrain and mat == Enum.Material.Water then
if (tick()-lastAdjustment) > nextAdjustment then
lastAdjustment = tick()
nextAdjustment = math.random(10,30)
destination =( (root.CFrame*CFrame.Angles(0,math.rad(math.random(0,359)),0))*CFrame.new(0,0,-40)).p
holdDuration = 2
holdOrder = tick()
else
destination = (root.CFrame*CFrame.new(0,0,-25)).p
end
end
elseif part and part~= workspace.Terrain then
destination = (root.CFrame*CFrame.new(0,0,-25)).p
elseif not part then
destination = ((root.CFrame*CFrame.Angles(0,math.rad(180),0))*CFrame.new(0,0,-40)).p
holdDuration = 4
holdOrder = tick()
end
bodyPos.Position = Vector3.new(destination.X,-6,destination.Z)
bodyGyro.CFrame = CFrame.new(CFrame.new(root.CFrame.p.X,-6,root.CFrame.p.Z).p,CFrame.new(destination.X,-6,destination.Z).p)
elseif stance == "attack" then
bodyPos.Position = destination
bodyGyro.CFrame = CFrame.new(root.Position,Vector3.new(destination.X,root.Position.Y,destination.Z))
if (shark.PrimaryPart.Position-target.PrimaryPart.Position).magnitude < 10 then
|
--[[
Automatic coercion to strings for LogInfo objects to enable debugging them
more easily.
]]
|
function logInfoMetatable:__tostring()
local outputBuffer = {"LogInfo {"}
local errorCount = #self.errors
local warningCount = #self.warnings
local infosCount = #self.infos
if errorCount + warningCount + infosCount == 0 then
table.insert(outputBuffer, "\t(no messages)")
end
if errorCount > 0 then
table.insert(outputBuffer, ("\tErrors (%d) {"):format(errorCount))
table.insert(outputBuffer, indentLines(self.errors, 2))
table.insert(outputBuffer, "\t}")
end
if warningCount > 0 then
table.insert(outputBuffer, ("\tWarnings (%d) {"):format(warningCount))
table.insert(outputBuffer, indentLines(self.warnings, 2))
table.insert(outputBuffer, "\t}")
end
if infosCount > 0 then
table.insert(outputBuffer, ("\tInfos (%d) {"):format(infosCount))
table.insert(outputBuffer, indentLines(self.infos, 2))
table.insert(outputBuffer, "\t}")
end
table.insert(outputBuffer, "}")
return table.concat(outputBuffer, "\n")
end
local function createLogInfo()
local logInfo = {
errors = {},
warnings = {},
infos = {},
}
setmetatable(logInfo, logInfoMetatable)
return logInfo
end
local Logging = {}
|
-- Computes the look-angle to be used by the client.
-- If no lookVector is provided, the camera's lookVector is used instead.
-- useDir (-1 or 1) can be given to force whether the direction is flipped or not.
|
function CharacterRealism:ComputeLookAngle(lookVector, useDir)
local inFirstPerson = FpsCamera:IsInFirstPerson()
local pitch, yaw, dir = 0, 0, 1
if not lookVector then
local camera = workspace.CurrentCamera
lookVector = camera.CFrame.LookVector
end
if lookVector then
local character = self.Player.Character
local rootPart = character and character:FindFirstChild("HumanoidRootPart")
if rootPart and rootPart:IsA("BasePart") then
local cf = rootPart.CFrame
pitch = -cf.RightVector:Dot(lookVector)
if not inFirstPerson then
dir = math.clamp(cf.LookVector:Dot(lookVector) * 10, -1, 1)
end
end
yaw = lookVector.Y
end
if useDir then
dir = useDir
end
pitch *= dir
yaw *= dir
return pitch, yaw
end
|
--[[ Initialization/Setup ]]
|
--
local function createTouchGuiContainer()
if TouchGui then TouchGui:Destroy() end
-- Container for all touch device guis
TouchGui = Instance.new('ScreenGui')
TouchGui.Name = "TouchGui"
TouchGui.Parent = PlayerGui
TouchControlFrame = Instance.new('Frame')
TouchControlFrame.Name = "TouchControlFrame"
TouchControlFrame.Size = UDim2.new(1, 0, 1, 0)
TouchControlFrame.BackgroundTransparency = 1
TouchControlFrame.Parent = TouchGui
ControlModules.Thumbstick:Create(TouchControlFrame)
ControlModules.DPad:Create(TouchControlFrame)
ControlModules.Thumbpad:Create(TouchControlFrame)
TouchJumpModule:Create(TouchControlFrame)
end
|
-- used by several guis to show no selection adorn
|
local noSelectionObject = Util.Create'ImageLabel'
{
Image = "",
BackgroundTransparency = 1
};
|
--Engine [https://www.desmos.com/calculator/mpkd3kxovu]
|
Tune.Horsepower = 1040
Tune.IdleRPM = 900
Tune.PeakRPM = 9500
Tune.Redline = 10000
Tune.IdleOffset = 7
Tune.RevAccel = 450
Tune.RevDecay = 150
Tune.RevBounce = 500
Tune.IdleThrottle = .01
Tune.ClutchTol = 1000
|
-- Customization
|
AntiTK = true; -- Set to false to allow TK and damaging of NPC, true for no TK. (To damage NPC, this needs to be false)
MouseSense = 0.5;
CanAim = true; -- Allows player to aim
CanBolt = false; -- When shooting, if this is enabled, the bolt will move (SCAR-L, ACR, AK Series)
LaserAttached = true;
LightAttached = true;
TracerEnabled = true;
|
----------//Animation Loader\\----------
|
function EquipAnim()
AnimDebounce = false
pcall(function()
AnimData.EquipAnim({
RArmWeld,
LArmWeld,
GunWeld,
WeaponInHand,
ViewModel,
})
end)
AnimDebounce = true
end
function IdleAnim()
pcall(function()
AnimData.IdleAnim({
RArmWeld,
LArmWeld,
GunWeld,
WeaponInHand,
ViewModel,
})
end)
AnimDebounce = true
end
function SprintAnim()
AnimDebounce = false
pcall(function()
AnimData.SprintAnim({
RArmWeld,
LArmWeld,
GunWeld,
WeaponInHand,
ViewModel,
})
end)
end
function HighReady()
pcall(function()
AnimData.HighReady({
RArmWeld,
LArmWeld,
GunWeld,
WeaponInHand,
ViewModel,
})
end)
end
function LowReady()
pcall(function()
AnimData.LowReady({
RArmWeld,
LArmWeld,
GunWeld,
WeaponInHand,
ViewModel,
})
end)
end
function Patrol()
pcall(function()
AnimData.Patrol({
RArmWeld,
LArmWeld,
GunWeld,
WeaponInHand,
ViewModel,
})
end)
end
function ReloadAnim()
pcall(function()
AnimData.ReloadAnim({
RArmWeld,
LArmWeld,
GunWeld,
WeaponInHand,
ViewModel,
})
end)
end
function TacticalReloadAnim()
--pcall(function()
AnimData.TacticalReloadAnim({
RArmWeld,
LArmWeld,
GunWeld,
WeaponInHand,
ViewModel,
})
--end)
end
function JammedAnim()
pcall(function()
AnimData.JammedAnim({
RArmWeld,
LArmWeld,
GunWeld,
WeaponInHand,
ViewModel,
})
end)
end
function PumpAnim()
reloading = true
pcall(function()
AnimData.PumpAnim({
RArmWeld,
LArmWeld,
GunWeld,
WeaponInHand,
ViewModel,
})
end)
reloading = false
end
function MagCheckAnim()
CheckingMag = true
pcall(function()
AnimData.MagCheck({
RArmWeld,
LArmWeld,
GunWeld,
WeaponInHand,
ViewModel,
})
end)
CheckingMag = false
end
function meleeAttack()
pcall(function()
AnimData.meleeAttack({
RArmWeld,
LArmWeld,
GunWeld,
WeaponInHand,
ViewModel,
})
end)
end
function GrenadeReady()
pcall(function()
AnimData.GrenadeReady({
RArmWeld,
LArmWeld,
GunWeld,
WeaponInHand,
ViewModel,
})
end)
end
function GrenadeThrow()
pcall(function()
AnimData.GrenadeThrow({
RArmWeld,
LArmWeld,
GunWeld,
WeaponInHand,
ViewModel,
})
end)
end
|
--////////////////////////////// Methods
--//////////////////////////////////////
|
local methods = {}
methods.__index = methods
function methods:SendSystemMessage(message, extraData)
local messageObj = self:InternalCreateMessageObject(message, nil, true, extraData)
local success, err = pcall(function() self.eMessagePosted:Fire(messageObj) end)
if not success and err then
print("Error posting message: " ..err)
end
self:InternalAddMessageToHistoryLog(messageObj)
for i, speaker in pairs(self.Speakers) do
speaker:InternalSendSystemMessage(messageObj, self.Name)
end
return messageObj
end
function methods:SendSystemMessageToSpeaker(message, speakerName, extraData)
local speaker = self.Speakers[speakerName]
if (speaker) then
local messageObj = self:InternalCreateMessageObject(message, nil, true, extraData)
speaker:InternalSendSystemMessage(messageObj, self.Name)
else
warn(string.format("Speaker '%s' is not in channel '%s' and cannot be sent a system message", speakerName, self.Name))
end
end
function methods:SendMessageObjToFilters(message, messageObj, fromSpeaker)
local oldMessage = messageObj.Message
messageObj.Message = message
self:InternalDoMessageFilter(fromSpeaker.Name, messageObj, self.Name)
self.ChatService:InternalDoMessageFilter(fromSpeaker.Name, messageObj, self.Name)
local newMessage = messageObj.Message
messageObj.Message = oldMessage
return newMessage
end
function methods:CanCommunicateByUserId(userId1, userId2)
if RunService:IsStudio() then
return true
end
-- UserId is set as 0 for non player speakers.
if userId1 == 0 or userId2 == 0 then
return true
end
local success, canCommunicate = pcall(function()
return Chat:CanUsersChatAsync(userId1, userId2)
end)
return success and canCommunicate
end
function methods:CanCommunicate(speakerObj1, speakerObj2)
local player1 = speakerObj1:GetPlayer()
local player2 = speakerObj2:GetPlayer()
if player1 and player2 then
return self:CanCommunicateByUserId(player1.UserId, player2.UserId)
end
return true
end
function methods:SendMessageToSpeaker(message, speakerName, fromSpeakerName, extraData)
local speakerTo = self.Speakers[speakerName]
local speakerFrom = self.ChatService:GetSpeaker(fromSpeakerName)
if speakerTo and speakerFrom then
local isMuted = speakerTo:IsSpeakerMuted(fromSpeakerName)
if isMuted then
return
end
if not self:CanCommunicate(speakerTo, speakerFrom) then
return
end
-- We need to claim the message is filtered even if it not in this case for compatibility with legacy client side code.
local isFiltered = speakerName == fromSpeakerName
local messageObj = self:InternalCreateMessageObject(message, fromSpeakerName, isFiltered, extraData)
message = self:SendMessageObjToFilters(message, messageObj, fromSpeakerName)
speakerTo:InternalSendMessage(messageObj, self.Name)
--// START FFLAG
if (not IN_GAME_CHAT_USE_NEW_FILTER_API) then --// USES FFLAG
--// OLD BEHAVIOR
local filteredMessage = self.ChatService:InternalApplyRobloxFilter(messageObj.FromSpeaker, message, speakerName)
if filteredMessage then
messageObj.Message = filteredMessage
messageObj.IsFiltered = true
speakerTo:InternalSendFilteredMessage(messageObj, self.Name)
end
--// OLD BEHAVIOR
else
--// NEW BEHAVIOR
local textContext = self.Private and Enum.TextFilterContext.PrivateChat or Enum.TextFilterContext.PublicChat
local filterSuccess, isFilterResult, filteredMessage = self.ChatService:InternalApplyRobloxFilterNewAPI(
messageObj.FromSpeaker,
message,
textContext
)
if (filterSuccess) then
messageObj.FilterResult = filteredMessage
messageObj.IsFilterResult = isFilterResult
messageObj.IsFiltered = true
speakerTo:InternalSendFilteredMessageWithFilterResult(messageObj, self.Name)
end
--// NEW BEHAVIOR
end
--// END FFLAG
else
warn(string.format("Speaker '%s' is not in channel '%s' and cannot be sent a message", speakerName, self.Name))
end
end
function methods:KickSpeaker(speakerName, reason)
local speaker = self.ChatService:GetSpeaker(speakerName)
if (not speaker) then
error("Speaker \"" .. speakerName .. "\" does not exist!")
end
local messageToSpeaker = ""
local messageToChannel = ""
if (reason) then
messageToSpeaker = string.format("You were kicked from '%s' for the following reason(s): %s", self.Name, reason)
messageToChannel = string.format("%s was kicked for the following reason(s): %s", speakerName, reason)
else
messageToSpeaker = string.format("You were kicked from '%s'", self.Name)
messageToChannel = string.format("%s was kicked", speakerName)
end
self:SendSystemMessageToSpeaker(messageToSpeaker, speakerName)
speaker:LeaveChannel(self.Name)
self:SendSystemMessage(messageToChannel)
end
function methods:MuteSpeaker(speakerName, reason, length)
local speaker = self.ChatService:GetSpeaker(speakerName)
if (not speaker) then
error("Speaker \"" .. speakerName .. "\" does not exist!")
end
self.Mutes[speakerName:lower()] = (length == 0 or length == nil) and 0 or (os.time() + length)
if (reason) then
self:SendSystemMessage(string.format("%s was muted for the following reason(s): %s", speakerName, reason))
end
local success, err = pcall(function() self.eSpeakerMuted:Fire(speakerName, reason, length) end)
if not success and err then
print("Error mutting speaker: " ..err)
end
local spkr = self.ChatService:GetSpeaker(speakerName)
if (spkr) then
local success, err = pcall(function() spkr.eMuted:Fire(self.Name, reason, length) end)
if not success and err then
print("Error mutting speaker: " ..err)
end
end
end
function methods:UnmuteSpeaker(speakerName)
local speaker = self.ChatService:GetSpeaker(speakerName)
if (not speaker) then
error("Speaker \"" .. speakerName .. "\" does not exist!")
end
self.Mutes[speakerName:lower()] = nil
local success, err = pcall(function() self.eSpeakerUnmuted:Fire(speakerName) end)
if not success and err then
print("Error unmuting speaker: " ..err)
end
local spkr = self.ChatService:GetSpeaker(speakerName)
if (spkr) then
local success, err = pcall(function() spkr.eUnmuted:Fire(self.Name) end)
if not success and err then
print("Error unmuting speaker: " ..err)
end
end
end
function methods:IsSpeakerMuted(speakerName)
return (self.Mutes[speakerName:lower()] ~= nil)
end
function methods:GetSpeakerList()
local list = {}
for i, speaker in pairs(self.Speakers) do
table.insert(list, speaker.Name)
end
return list
end
function methods:RegisterFilterMessageFunction(funcId, func, priority)
if self.FilterMessageFunctions:HasFunction(funcId) then
error(string.format("FilterMessageFunction '%s' already exists", funcId))
end
self.FilterMessageFunctions:AddFunction(funcId, func, priority)
end
function methods:FilterMessageFunctionExists(funcId)
return self.FilterMessageFunctions:HasFunction(funcId)
end
function methods:UnregisterFilterMessageFunction(funcId)
if not self.FilterMessageFunctions:HasFunction(funcId) then
error(string.format("FilterMessageFunction '%s' does not exists", funcId))
end
self.FilterMessageFunctions:RemoveFunction(funcId)
end
function methods:RegisterProcessCommandsFunction(funcId, func, priority)
if self.ProcessCommandsFunctions:HasFunction(funcId) then
error(string.format("ProcessCommandsFunction '%s' already exists", funcId))
end
self.ProcessCommandsFunctions:AddFunction(funcId, func, priority)
end
function methods:ProcessCommandsFunctionExists(funcId)
return self.ProcessCommandsFunctions:HasFunction(funcId)
end
function methods:UnregisterProcessCommandsFunction(funcId)
if not self.ProcessCommandsFunctions:HasFunction(funcId) then
error(string.format("ProcessCommandsFunction '%s' does not exist", funcId))
end
self.ProcessCommandsFunctions:RemoveFunction(funcId)
end
local function ShallowCopy(table)
local copy = {}
for i, v in pairs(table) do
copy[i] = v
end
return copy
end
function methods:GetHistoryLog()
return ShallowCopy(self.ChatHistory)
end
function methods:GetHistoryLogForSpeaker(speaker)
local userId = -1
local player = speaker:GetPlayer()
if player then
userId = player.UserId
end
local chatlog = {}
--// START FFLAG
if (not IN_GAME_CHAT_USE_NEW_FILTER_API) then --// USES FFLAG
--// OLD BEHAVIOR
for i = 1, #self.ChatHistory do
local logUserId = self.ChatHistory[i].SpeakerUserId
if self:CanCommunicateByUserId(userId, logUserId) then
table.insert(chatlog, ShallowCopy(self.ChatHistory[i]))
end
end
--// OLD BEHAVIOR
else
--// NEW BEHAVIOR
for i = 1, #self.ChatHistory do
local logUserId = self.ChatHistory[i].SpeakerUserId
if self:CanCommunicateByUserId(userId, logUserId) then
local messageObj = ShallowCopy(self.ChatHistory[i])
--// Since we're using the new filter API, we need to convert the stored filter result
--// into an actual string message to send to players for their chat history.
--// System messages aren't filtered the same way, so they just have a regular
--// text value in the Message field.
if (messageObj.MessageType == ChatConstants.MessageTypeDefault or messageObj.MessageType == ChatConstants.MessageTypeMeCommand) then
local filterResult = messageObj.FilterResult
if (messageObj.IsFilterResult) then
if (player) then
messageObj.Message = filterResult:GetChatForUserAsync(player.UserId)
else
messageObj.Message = filterResult:GetNonChatStringForBroadcastAsync()
end
else
messageObj.Message = filterResult
end
end
table.insert(chatlog, messageObj)
end
end
--// NEW BEHAVIOR
end
--// END FFLAG
return chatlog
end
|
--[[
State
]]
|
local startPosition = maid.instance.PrimaryPart.Position
|
--Animation
|
local animController = script.Parent:WaitForChild'AnimationController'
local walk = Instance.new'Animation'
walk.AnimationId = game.ReplicatedStorage.NPCAnimations.BantoWalk.AnimationId
walk = animController:LoadAnimation(walk)
|
-- tableUtil.Assign(Table target, ...Table sources)
|
local function Assign(target, ...)
for _,src in ipairs({...}) do
for k,v in pairs(src) do
target[k] = v
end
end
return target
end
local function Extend(tbl, extension)
for k,v in pairs(extension) do
tbl[k] = v
end
end
local function Print(tbl, label, deepPrint)
assert(type(tbl) == "table", "First argument must be a table")
assert(label == nil or type(label) == "string", "Second argument must be a string or nil")
label = (label or "TABLE")
local strTbl = {}
local indent = " - "
-- Insert(string, indentLevel)
local function Insert(s, l)
strTbl[#strTbl + 1] = (indent:rep(l) .. s .. "\n")
end
local function AlphaKeySort(a, b)
return (tostring(a.k) < tostring(b.k))
end
local function PrintTable(t, lvl, lbl)
Insert(lbl .. ":", lvl - 1)
local nonTbls = {}
local tbls = {}
local keySpaces = 0
for k,v in pairs(t) do
if (type(v) == "table") then
table.insert(tbls, {k = k, v = v})
else
table.insert(nonTbls, {k = k, v = "[" .. typeof(v) .. "] " .. tostring(v)})
end
local spaces = #tostring(k) + 1
if (spaces > keySpaces) then
keySpaces = spaces
end
end
table.sort(nonTbls, AlphaKeySort)
table.sort(tbls, AlphaKeySort)
for _,v in ipairs(nonTbls) do
Insert(tostring(v.k) .. ":" .. (" "):rep(keySpaces - #tostring(v.k)) .. v.v, lvl)
end
if (deepPrint) then
for _,v in ipairs(tbls) do
PrintTable(v.v, lvl + 1, tostring(v.k) .. (" "):rep(keySpaces - #tostring(v.k)) .. " [Table]")
end
else
for _,v in ipairs(tbls) do
Insert(tostring(v.k) .. ":" .. (" "):rep(keySpaces - #tostring(v.k)) .. "[Table]", lvl)
end
end
end
PrintTable(tbl, 1, label)
print(table.concat(strTbl, ""))
end
local function Reverse(tbl)
local n = #tbl
local tblRev = table.create(n)
for i = 1,n do
tblRev[i] = tbl[n - i + 1]
end
return tblRev
end
local function Shuffle(tbl)
assert(type(tbl) == "table", "First argument must be a table")
local rng = Random.new()
for i = #tbl, 2, -1 do
local j = rng:NextInteger(1, i)
tbl[i], tbl[j] = tbl[j], tbl[i]
end
end
local function IsEmpty(tbl)
return (next(tbl) == nil)
end
local function EncodeJSON(tbl)
return http:JSONEncode(tbl)
end
local function DecodeJSON(str)
return http:JSONDecode(str)
end
local function FastRemoveFirstValue(t, v)
local index = IndexOf(t, v)
if (index) then
FastRemove(t, index)
return true, index
end
return false, nil
end
TableUtil.Copy = CopyTable
TableUtil.CopyShallow = CopyTableShallow
TableUtil.Sync = Sync
TableUtil.FastRemove = FastRemove
TableUtil.FastRemoveFirstValue = FastRemoveFirstValue
TableUtil.Print = Print
TableUtil.Map = Map
TableUtil.Filter = Filter
TableUtil.Reduce = Reduce
TableUtil.Assign = Assign
TableUtil.Extend = Extend
TableUtil.IndexOf = IndexOf
TableUtil.Reverse = Reverse
TableUtil.Shuffle = Shuffle
TableUtil.IsEmpty = IsEmpty
TableUtil.EncodeJSON = EncodeJSON
TableUtil.DecodeJSON = DecodeJSON
return TableUtil
|
--nextsound=0
|
nextjump=0
chasing=false
variance=4
damage=26
attackrange=5
sightrange=100
runspeed=26
wonderspeed=16
healthregen=true
colors={"Really black"}
function raycast(spos,vec,currentdist)
local hit2,pos2=game.Workspace:FindPartOnRay(Ray.new(spos+(vec*.01),vec*currentdist),sp)
if hit2~=nil and pos2 then
if hit2.Transparency>=.8 or hit2.Name=="Handle" or string.sub(hit2.Name,1,6)=="Effect" then
local currentdist=currentdist-(pos2-spos).magnitude
return raycast(pos2,vec,currentdist)
end
end
return hit2,pos2
end
function waitForChild(parent,childName)
local child=parent:findFirstChild(childName)
if child then return child end
while true do
child=parent.ChildAdded:wait()
if child.Name==childName then return child end
end
end
|
--FasCast Setup--
|
local FastCast = require(script:WaitForChild("FastCastRedux"))
local Params = RaycastParams.new()
Params.FilterType = Enum.RaycastFilterType.Blacklist -- just the type of filter
Params.FilterDescendantsInstances = {workspace.Terrain,marine} -- you can add more things to this list btw
if workspace:FindFirstChild("IgnoreFolder") == nil then
local IgnoreList = Instance.new("Folder",workspace)
IgnoreList.Name = "IgnoreFolder"
end
local NewCaster = FastCast.new()
local Behaviour = FastCast.newBehavior()
Behaviour.Acceleration = bulletacceleration
Behaviour.RaycastParams = Params
Behaviour.AutoIgnoreFolder = false
Behaviour.CosmeticBulletContainer = workspace.IgnoreFolder
Behaviour.CosmeticBulletTemplate = game.ServerStorage:WaitForChild("Bullet")
Behaviour.MaxDistance = maxdistance
|
---[[ Chat Behaviour Settings ]]
|
module.WindowDraggable = false
module.WindowResizable = false
module.ShowChannelsBar = false
module.GamepadNavigationEnabled = false
module.AllowMeCommand = true -- Me Command will only be effective when this set to true
module.ShowUserOwnFilteredMessage = true --Show a user the filtered version of their message rather than the original.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.