prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
-- Set up the event handlers for the TextButton icons in the gui.Main frame |
local buttons = openGui:GetChildren()
for _, button in ipairs(buttons) do
if button:IsA("TextButton") then
button.MouseButton1Click:Connect(function()
openGui.Visible = false
toggleWindow(button)
end)
end
end
|
-- ROBLOX deviation: currently no way – type the __call metamethod
-- {
-- __call: (any, any, any?) -> ExpectationResult,
-- -- ROBLOX deviation: [INTERNAL_MATCHER_FLAG]: boolean?
-- [Symbol]: boolean?
-- } |
export type ThrowingMatcherFn = (any) -> ()
export type PromiseMatcherFn = (any) -> Promise<nil>
export type Tester = (any, any) -> boolean?
export type MatcherState = {
assertionCalls: number,
currentTestName: string?,
dontThrow: (() -> ())?,
error: Error?,
equals: (any, any, Array<Tester>?, boolean?) -> boolean,
expand: boolean?,
expectedAssertionsNumber: number?,
expectedAssertionsNumberError: Error?,
isExpectingAssertions: boolean?,
isExpectingAssertionsError: Error?,
isNot: boolean,
promise: string,
suppressedErrors: Array<Error>,
testPath: any, -- ROBLOX TODO: Config.Path?,
utils: Object, -- ROBLOX deviation: no easy way to port to Lua: typeof jestMatcherUtils & {
-- iterableEquality: Tester;
-- subsetEquality: Tester;
-- }
}
export type AsymmetricMatcher = {
asymmetricMatch: (self: AsymmetricMatcher, other: unknown) -> boolean,
toString: (self: AsymmetricMatcher) -> string,
getExpectedType: ((self: AsymmetricMatcher) -> string)?,
toAsymmetricMatcher: ((self: AsymmetricMatcher) -> string)?,
}
|
-- Recursive table copy. |
function Util.DeepCopy(tbl: AnyTable): AnyTable
local newTbl = table.clone(tbl)
for k, v in pairs(newTbl) do
if type(v) == "table" then
newTbl[k] = Util.DeepCopy(v)
end
end
return newTbl
end
|
--[[
VectorUtil.ClampMagnitude(vector, maxMagnitude)
VectorUtil.AngleBetween(vector1, vector2)
VectorUtil.AngleBetweenSigned(vector1, vector2, axisVector)
EXAMPLES:
ClampMagnitude:
Clamps the magnitude of a vector so it is only a certain length.
ClampMagnitude(Vector3.new(100, 0, 0), 15) == Vector3.new(15, 0, 0)
ClampMagnitude(Vector3.new(10, 0, 0), 20) == Vector3.new(10, 0, 0)
AngleBetween:
Finds the angle (in radians) between two vectors.
v1 = Vector3.new(10, 0, 0)
v2 = Vector3.new(0, 10, 0)
AngleBetween(v1, v2) == math.rad(90)
AngleBetweenSigned:
Same as AngleBetween, but returns a signed value.
v1 = Vector3.new(10, 0, 0)
v2 = Vector3.new(0, 0, -10)
axis = Vector3.new(0, 1, 0)
AngleBetweenSigned(v1, v2, axis) == math.rad(90)
--]] |
local VectorUtil = {}
function VectorUtil.ClampMagnitude(vector, maxMagnitude)
return (vector.Magnitude > maxMagnitude and (vector.Unit * maxMagnitude) or vector)
end
function VectorUtil.AngleBetween(vector1, vector2)
return math.acos(math.clamp(vector1.Unit:Dot(vector2.Unit), -1, 1))
end
function VectorUtil.AngleBetweenSigned(vector1, vector2, axisVector)
local angle = VectorUtil.AngleBetween(vector1, vector2)
return angle * math.sign(axisVector:Dot(vector1:Cross(vector2)))
end
return VectorUtil
|
--[=[
Extracts the locale from the folder, or a locale and table.
@param first Instance | string
@param second table?
@return LocalizationTable
]=] |
function JsonToLocalizationTable.toLocalizationTable(first, second)
if typeof(first) == "Instance" then
local result = JsonToLocalizationTable.loadFolder(first)
-- result.Name = ("JSONTable_%s"):format(first.Name)
return result
elseif type(first) == "string" and type(second) == "table" then
local result = JsonToLocalizationTable.loadTable(first, second)
return result
else
error("Bad args")
end
end
|
--[=[
@param fn ConnectionFn
@return SignalConnection
Connects a function to the signal, which will be called the next time the signal fires. Once
the connection is triggered, it will disconnect itself.
```lua
signal:Once(function(msg, num)
print(msg, num)
end)
signal:Fire("Hello", 25)
signal:Fire("This message will not go through", 10)
```
]=] |
function Signal:Once(fn)
local connection
local done = false
connection = self:Connect(function(...)
if done then
return
end
done = true
connection:Disconnect()
fn(...)
end)
return connection
end
function Signal:GetConnections()
local items = {}
local item = self._handlerListHead
while item do
table.insert(items, item)
item = item._next
end
return items
end
|
--StrobeFunctions----------------------------------------- |
script.Parent.Configuration.Strobe.Changed:connect(function()
while script.Parent.Configuration.Strobe.Value == 1 do
wait(0.01)
colorval = script.Parent.Configuration.Colour.Value
Model.Configuration.LampStatus.Value = 0
for i,v in pairs(Model.Tilt:GetChildren()) do
if v.Name == "Lamp" then
v.BrickColor = BrickColor.new(Color3.new(35/255,35/255,35/255))
end
end
wait(0.01)
Model.Configuration.LampStatus.Value = 1
for i,v in pairs(Model.Tilt:GetChildren()) do
if v.Name == "Lamp" then
v.BrickColor = BrickColor.new(colorval)
end
end
end
while script.Parent.Configuration.Strobe.Value == 2 do
wait(0.05)
colorval = script.Parent.Configuration.Colour.Value
Model.Configuration.LampStatus.Value = 0
for i,v in pairs(Model.Tilt:GetChildren()) do
if v.Name == "Lamp" then
v.BrickColor = BrickColor.new(Color3.new(35/255,35/255,35/255))
end
end
wait(0.05)
Model.Configuration.LampStatus.Value = 1
for i,v in pairs(Model.Tilt:GetChildren()) do
if v.Name == "Lamp" then
v.BrickColor = BrickColor.new(colorval)
end
end
end
while script.Parent.Configuration.Strobe.Value == 3 do
wait(1)
colorval = script.Parent.Configuration.Colour.Value
Model.Configuration.LampStatus.Value = 0
for i,v in pairs(Model.Tilt:GetChildren()) do
if v.Name == "Lamp" then
v.BrickColor = BrickColor.new(Color3.new(35/255,35/255,35/255))
end
end
wait(1)
Model.Configuration.LampStatus.Value = 1
for i,v in pairs(Model.Tilt:GetChildren()) do
if v.Name == "Lamp" then
v.BrickColor = BrickColor.new(colorval)
end
end
end
while script.Parent.Configuration.Strobe.Value == 4 do
wait(math.random())
colorval = script.Parent.Configuration.Colour.Value
Model.Configuration.LampStatus.Value = 0
for i,v in pairs(Model.Tilt:GetChildren()) do
if v.Name == "Lamp" then
v.BrickColor = BrickColor.new(Color3.new(35/255,35/255,35/255))
end
end
wait(math.random())
Model.Configuration.LampStatus.Value = 1
for i,v in pairs(Model.Tilt:GetChildren()) do
if v.Name == "Lamp" then
v.BrickColor = BrickColor.new(colorval)
end
end
end
end) |
-- map a value from one range to another |
local function map(x, inMin, inMax, outMin, outMax)
return (x - inMin)*(outMax - outMin)/(inMax - inMin) + outMin
end
local function playSound(sound)
sound.TimePosition = 0
sound.Playing = true
end
local function stopSound(sound)
sound.Playing = false
sound.TimePosition = 0
end
local function initializeSoundSystem(player, humanoid, rootPart)
local sounds = {}
-- initialize sounds
for name, props in pairs(SOUND_DATA) do
local 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 in pairs(props) do
sound[propName] = propValue
end
sound.Parent = rootPart
sounds[name] = sound
end
local playingLoopedSounds = {}
local function stopPlayingLoopedSounds(except)
for sound in pairs(playingLoopedSounds) do
if sound ~= except then
sound.Playing = false
playingLoopedSounds[sound] = nil
end
end
end
-- state transition callbacks
local stateTransitions = {
[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 = {
[sounds.Climbing] = function(dt, sound, vel)
sound.Playing = vel.Magnitude > 0.1
end,
[sounds.FreeFalling] = function(dt, sound, vel)
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, sound, vel)
--sound.Playing = vel.Magnitude > 0.5 and humanoid.MoveDirection.Magnitude > 0.5
sound.SoundId = FootstepsSoundGroup:WaitForChild(humanoid.FloorMaterial).SoundId
sound.PlaybackSpeed = FootstepsSoundGroup:WaitForChild(humanoid.FloorMaterial).PlaybackSpeed * (vel.Magnitude/20)
sound.Volume = FootstepsSoundGroup:WaitForChild(humanoid.FloorMaterial).Volume * (vel.Magnitude/12) * Players.LocalPlayer.Character:WaitForChild("ACS_Client"):WaitForChild("Stances"):WaitForChild("Loudness").Value
sound.EmitterSize = FootstepsSoundGroup:WaitForChild(humanoid.FloorMaterial).Volume * (vel.Magnitude/12) * 50 * Players.LocalPlayer.Character:WaitForChild("ACS_Client"):WaitForChild("Stances"):WaitForChild("Loudness").Value
if FootstepsSoundGroup:FindFirstChild(humanoid.FloorMaterial) == nil then
sound.SoundId = FootstepsSoundGroup:WaitForChild("nil Sound").SoundId
sound.PlaybackSpeed = FootstepsSoundGroup:WaitForChild("nil Sound").PlaybackSpeed
sound.EmitterSize = FootstepsSoundGroup:WaitForChild("nil Sound").Volume
sound.Volume = FootstepsSoundGroup:WaitForChild("nil Sound").Volume
end
end,
}
-- state substitutions to avoid duplicating entries in the state table
local stateRemap = {
[Enum.HumanoidStateType.RunningNoPhysics] = Enum.HumanoidStateType.Running,
}
local activeState = stateRemap[humanoid:GetState()] or humanoid:GetState()
local activeConnections = {}
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)
-- update looped sounds on stepped
for sound in pairs(playingLoopedSounds) do
local updater = loopedSoundUpdaters[sound]
if updater then
updater(worldDt, sound, rootPart.Velocity)
end
end
end)
local humanoidAncestryChangedConn
local rootPartAncestryChangedConn
local characterAddedConn
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)
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
repeat
wait()
until game.Players.LocalPlayer.Character
local Character = game.Players.LocalPlayer.Character
local Head = Character:WaitForChild("HumanoidRootPart")
local RunningSound = Head:WaitForChild("Running")
local Humanoid = Character:WaitForChild("Humanoid")
local vel = 0
Humanoid.Changed:Connect(function(property)
end)
Humanoid.Running:connect(function(a)
RunningSound.PlaybackSpeed = FootstepsSoundGroup:WaitForChild(Humanoid.FloorMaterial).PlaybackSpeed * (a/20) * (math.random(30,50)/40)
RunningSound.Volume = FootstepsSoundGroup:WaitForChild(Humanoid.FloorMaterial).Volume * (vel/12)
RunningSound.EmitterSize = FootstepsSoundGroup:WaitForChild(Humanoid.FloorMaterial).Volume * (vel/12) * 50
vel = a
end)
|
--Made by Luckymaxer |
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Players = game:GetService("Players")
ServerControl = Tool:WaitForChild("ServerControl")
function InvokeServer(Mode, Value)
pcall(function()
ServerControl:InvokeServer(Mode, Value)
end)
end
function Equipped(Mouse)
Character = Tool.Parent
Player = Players:GetPlayerFromCharacter(Character)
Humanoid = Character:FindFirstChild("Humanoid")
if not Player or not Humanoid or Humanoid.Health == 0 then
return
end
Mouse.Button1Down:connect(function()
InvokeServer("Click", true)
end)
Mouse.KeyDown:connect(function(Key)
InvokeServer("KeyPress", {Key = Key, Down = true})
end)
end
function Unequipped()
end
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
|
--[=[
@class MerchBooth
]=] |
local module = {
-- Server APIs
addItemAsync = addItemAsync(serverStore),
removeItem = removeItem(serverStore),
addProximityButton = addProximityButton(serverStore),
removeProximityButton = removeProximityButton(serverStore),
-- Client APIs
configure = configure(clientStore),
resetConfiguration = resetConfiguration(clientStore),
setCatalogSort = setCatalogSort(clientStore),
setEnabled = setEnabled(clientStore),
setControlKeyCodes = setControlKeyCodes(clientStore),
-- UI states functions (client only)
openMerchBooth = uiStatesFunctions.openMerchBooth(clientStore),
openItemView = uiStatesFunctions.openItemView(clientStore),
closeMerchBooth = uiStatesFunctions.closeMerchBooth(clientStore),
toggleCatalogButton = uiStatesFunctions.toggleCatalogButton(clientStore),
isMerchBoothOpen = uiStatesFunctions.isMerchBoothOpen(clientStore),
isMerchBoothEnabled = uiStatesFunctions.isMerchBoothEnabled(clientStore),
-- UI states events (client only)
merchBoothOpened = uiStatesEvents.merchBoothOpened.Event,
merchBoothClosed = uiStatesEvents.merchBoothClosed.Event,
catalogViewOpened = uiStatesEvents.catalogViewOpened.Event,
catalogViewClosed = uiStatesEvents.catalogViewClosed.Event,
itemViewOpened = uiStatesEvents.itemViewOpened.Event,
itemViewClosed = uiStatesEvents.itemViewClosed.Event,
-- Server and client APIs
getItems = getItems(serverStore, clientStore),
itemAdded = itemEvents.itemAdded.Event,
itemRemoved = itemEvents.itemRemoved.Event,
-- Enums
Controls = enums.Controls,
}
|
--//Settings |
BlurAmount = 50 -- Change this to increase or decrease the blur size
|
--[[
Calls the given analytics function and passes the given values.
Every analytics function sends the categoryIndex and subcategoryIndex from the store.
assetTypeId: optional
]] |
local function getUserId(state)
if state.LocalUserId then
return state.LocalUserId
end
if state.RobloxUser and state.RobloxUser.rbxuid then
return tostring(state.RobloxUser.rbxuid)
end
return nil
end
return function(analyticsFunction, value, assetTypeId)
return function(store)
local categoryIndex = store:getState().AvatarExperience.AvatarEditor.Categories.category
local subcategoryIndex = store:getState().AvatarExperience.AvatarEditor.Categories.subcategory
local userId = getUserId(store:getState())
analyticsFunction(value, categoryIndex, subcategoryIndex, assetTypeId, userId)
end
end
|
---Simply process a completed message. |
local COMPLETED_MESSAGE_PROCESSOR = 1
local module = {}
local methods = {}
methods.__index = methods
function methods:SendSystemMessageToSelf(message, channelObj, extraData)
local messageData =
{
ID = -1,
FromSpeaker = nil,
SpeakerUserId = 0,
OriginalChannel = channelObj.Name,
IsFiltered = true,
MessageLength = string.len(message),
Message = message,
MessageType = ChatConstants.MessageTypeSystem,
Time = os.time(),
ExtraData = extraData,
}
channelObj:AddMessageToChannel(messageData)
end
function module.new()
local obj = setmetatable({}, methods)
obj.COMMAND_MODULES_VERSION = COMMAND_MODULES_VERSION
obj.KEY_COMMAND_PROCESSOR_TYPE = KEY_COMMAND_PROCESSOR_TYPE
obj.KEY_PROCESSOR_FUNCTION = KEY_PROCESSOR_FUNCTION
obj.IN_PROGRESS_MESSAGE_PROCESSOR = IN_PROGRESS_MESSAGE_PROCESSOR
obj.COMPLETED_MESSAGE_PROCESSOR = COMPLETED_MESSAGE_PROCESSOR
return obj
end
return module.new()
|
--Controls |
local _CTRL = _Tune.Controls
local Controls = Instance.new("Folder",script.Parent)
Controls.Name = "Controls"
for i,v in pairs(_CTRL) do
local a=Instance.new("StringValue",Controls)
a.Name=i
a.Value=v.Name
a.Changed:connect(function()
if i=="MouseThrottle" or i=="MouseBrake" then
_CTRL[i]=Enum.UserInputType[a.Value]
else
_CTRL[i]=Enum.KeyCode[a.Value]
end
end)
end
function DealWithInput(input,IsRobloxFunction)
if (UserInputService:GetFocusedTextBox()==nil) and not _InControls then --No texting while driving
if _IsOn and (input.KeyCode ==_CTRL["ContlrShiftDown"] or (_MSteer and input.KeyCode==_CTRL["MouseShiftDown"]) or ((not _MSteer) and input.KeyCode==_CTRL["ShiftDown"])) and _TMode=="Manual" and (not _ClutchOn) and input.UserInputState == Enum.UserInputState.Begin then
if _CGear == 0 then _ClutchOn = true end
_CGear = math.max(_CGear-1,-1)
elseif _IsOn and (input.KeyCode ==_CTRL["ContlrShiftUp"] or (_MSteer and input.KeyCode==_CTRL["MouseShiftUp"]) or ((not _MSteer) and input.KeyCode==_CTRL["ShiftUp"])) and _TMode=="Manual" and (not _ClutchOn) and input.UserInputState == Enum.UserInputState.Begin then
if _CGear == 0 then _ClutchOn = true end
_CGear = math.min(_CGear+1,#_Tune.Ratios-2)
elseif _IsOn and (input.KeyCode ==_CTRL["ContlrClutch"] or (_MSteer and input.KeyCode==_CTRL["MouseClutch"]) or ((not _MSteer) and input.KeyCode==_CTRL["Clutch"])) and _TMode=="Manual" then
if input.UserInputState == Enum.UserInputState.Begin then
_ClutchOn = false
elseif input.UserInputState == Enum.UserInputState.End then
_ClutchOn = true
end
elseif _IsOn and input.KeyCode ==_CTRL["ContlrPBrake"] or (_MSteer and input.KeyCode==_CTRL["MousePBrake"]) or ((not _MSteer) and input.KeyCode==_CTRL["PBrake"]) then
if input.UserInputState == Enum.UserInputState.Begin then
_PBrake = not _PBrake
elseif input.UserInputState == Enum.UserInputState.End then
if car.DriveSeat.Velocity.Magnitude>5 then
_PBrake = false
end
end
elseif (input.KeyCode == _CTRL["ContlrToggleTMode"] or input.KeyCode==_CTRL["ToggleTransMode"]) and input.UserInputState == Enum.UserInputState.Begin then
local n=1
for i,v in pairs(_Tune.TransModes) do
if v==_TMode then n=i break end
end
n=n+1
if n>#_Tune.TransModes then n=1 end
_TMode = _Tune.TransModes[n]
elseif _IsOn and ((not _MSteer) and (input.KeyCode==_CTRL["Throttle"] or input.KeyCode == _CTRL["Throttle2"])) or (input.UserInputType == _CTRL["MouseThrottle"] and _MSteer) then
if input.UserInputState == Enum.UserInputState.Begin then
_GThrot = 1
else
_GThrot = _Tune.IdleThrottle
end
elseif ((not _MSteer) and (input.KeyCode==_CTRL["Brake"] or input.KeyCode == _CTRL["Brake2"])) or (input.UserInputType == _CTRL["MouseBrake"] and _MSteer) then
if input.UserInputState == Enum.UserInputState.Begin then
_GBrake = 1
else
_GBrake = 0
end
elseif (not _MSteer) and (input.KeyCode==_CTRL["SteerLeft"] or input.KeyCode == _CTRL["SteerLeft2"]) then
if input.UserInputState == Enum.UserInputState.Begin then
_GSteerT = -1
_SteerL = true
else
if _SteerR then
_GSteerT = 1
else
_GSteerT = 0
end
_SteerL = false
end
elseif (not _MSteer) and (input.KeyCode==_CTRL["SteerRight"] or input.KeyCode == _CTRL["SteerRight2"]) then
if input.UserInputState == Enum.UserInputState.Begin then
_GSteerT = 1
_SteerR = true
else
if _SteerL then
_GSteerT = -1
else
_GSteerT = 0
end
_SteerR = false
end
elseif input.KeyCode ==_CTRL["ToggleMouseDrive"] then
if input.UserInputState == Enum.UserInputState.End then
_MSteer = not _MSteer
_GThrot = _Tune.IdleThrottle
_GBrake = 0
_GSteerT = 0
_ClutchOn = true
end
elseif _IsOn and input.KeyCode == _CTRL["ToggleTCS"] or input.KeyCode == _CTRL["ContlrToggleTCS"] then
if input.UserInputState == Enum.UserInputState.End then
_TCS = not _TCS
end
end
if input.UserInputType.Name:find("Gamepad") then
if input.KeyCode == _CTRL["ContlrSteer"] then
if math.abs(input.Position.X)>_Tune.ControlDZone then
_GSteerT = math.abs(input.Position.X-_Tune.ControlDZone)*(input.Position.X/math.abs(input.Position.X))/(1-_Tune.ControlDZone)
else
_GSteerT = 0
end
elseif _IsOn and input.KeyCode == _CTRL["ContlrThrottle"] then
_GThrot = math.max(_Tune.IdleThrottle,input.Position.Z)
elseif input.KeyCode == _CTRL["ContlrBrake"] then
_GBrake = input.Position.Z
end
end
else
_GThrot = _Tune.IdleThrottle
_GSteerT = 0
_GBrake = 0
if _CGear~=0 then _ClutchOn = true end
end
end
UserInputService.InputBegan:connect(DealWithInput)
UserInputService.InputChanged:connect(DealWithInput)
UserInputService.InputEnded:connect(DealWithInput)
|
--Unlock Script
--Unless you know what you're doing, do not modify this script. |
local unlocked = false --This creates a bool for the door's status.
script.Parent.Touched:Connect(function(hit) --This detects a touch on the part.
if hit.Parent.Name == "Key" and unlocked == false then --This ensures the touching part is a key.
unlocked = true --This sets the door's status to unlocked.
script.Parent.Anchored = false --This unanchors the padlock.
script.Parent.Unlock:Play() --This plays the unlock sound.
wait(1) --This waits for 1 second to open the door.
script.Parent.Parent.Parent.Open:Play() --This plays the open sound.
script.Parent.Parent.Parent.Transparency = 0.25 --This causes the door to be slightly transparent.
script.Parent.Parent.Parent.CanCollide = false --This causes the door to stop colliding.
script.Parent.Parent.Parent.DoorScript.Disabled = false --This allows the door script to run.
script.Parent.Parent.Parent.NPCDoorScript.Disabled = false --This allows the NPC script to run.
end
end)
|
--- This will cause a brick to go in motion unanchored or not! --- |
while true do
wait()
for i= 1, 270 do
script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0,1,0)
wait()
end
for i= 1, 270 do
script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0,-1,0)
wait()
end
end
|
--[[Status Vars]] |
local snsrs = car.Body.Sensors
local _IsOn = _Tune.AutoStart
if _Tune.AutoStart then car.DriveSeat.IsOn.Value=true end
local _GSteerT=0
local _GSteerC=0
local _GThrot=0
local _GBrake=0
local _ClutchOn = true
local _ClPressing = false
local _RPM = 0
local _HP = 0
local _OutTorque = 0
local _CGear = 0
local _PGear = _CGear
local _spLimit = 0
local _TMode = _Tune.TransModes[1]
local _MSteer = false
local _SteerL = false
local _SteerR = false
local _PBrake = false
local _TCS = _Tune.TCSEnabled
local _TCSActive = false
local _ABS = _Tune.ABSEnabled
local _ABSActive = false
local FlipWait=tick()
local FlipDB=false
local _InControls = false
script.Parent.DriveMode.Changed:Connect(function()
if script.Parent.DriveMode.Value == "SportPlus" then
if _Tune.TCSEnabled and _IsOn then
_TCS = false
end
else
if _Tune.TCSEnabled and _IsOn then
_TCS = true
end
end
end)
|
--[[ icon_controller:header
## Functions
#### setGameTheme
```lua
IconController.setGameTheme(theme)
```
Sets the default theme which is applied to all existing and future icons.
----
#### setDisplayOrder
```lua
IconController.setDisplayOrder(number)
```
Changes the DisplayOrder of the TopbarPlus ScreenGui to the given value.
----
#### setTopbarEnabled
```lua
IconController.setTopbarEnabled(bool)
```
When set to ``false``, hides all icons created with TopbarPlus. This can also be achieved by calling ``starterGui:SetCore("TopbarEnabled", false)``.
----
#### setGap
```lua
IconController.setGap(integer, alignment)
```
Defines the offset width (i.e. gap) between each icon for the given alignment, ``left``, ``mid``, ``right``, or all alignments if not specified.
----
#### updateTopbar
```lua
IconController.updateTopbar()
```
Determines how icons should be positioned on the topbar and moves them accordingly.
----
#### clearIconOnSpawn
```lua
IconController.clearIconOnSpawn(icon)
```
Calls destroy on the given icon when the player respawns. This is useful for scenarious where you wish to cleanup icons that are constructed within a Gui with ``ResetOnSpawn`` set to ``true``. For example:
```lua
-- Place at the bottom of your icon creator localscript
local icons = IconController.getIcons()
for _, icon in pairs(icons) do
IconController.clearIconOnSpawn(icon)
end
```
----
#### getIcons
```lua
local arrayOfIcons = IconController.getIcons()
```
Returns all icons as an array.
----
#### getIcon
```lua
local icon = IconController.getIcon(name)
```
Returns the icon with the given name (or ``false`` if not found). If multiple icons have the same name, then one will be returned randomly.
----
## Properties
#### topbarEnabled
{read-only}
```lua
local bool = IconController.topbarEnabled
```
----
#### controllerModeEnabled
{read-only}
```lua
local bool = IconController.controllerModeEnabled
```
----
#### leftGap
{read-only}
```lua
local gapNumber = IconController.leftGap --[default: '12']
```
----
#### midGap
{read-only}
```lua
local gapNumber = IconController.midGap --[default: '12']
```
----
#### rightGap
{read-only}
```lua
local gapNumber = IconController.rightGap --[default: '12']
```
--]] | |
--Control Mapping |
Tune.Controls = {
--Keyboard Controls
--Mode Toggles
ToggleTCS = Enum.KeyCode.T ,
ToggleABS = Enum.KeyCode.Y ,
ToggleTransMode = Enum.KeyCode.M ,
ToggleMouseDrive = Enum.KeyCode.R ,
--Primary Controls
Throttle = Enum.KeyCode.Up ,
Brake = Enum.KeyCode.Down ,
SteerLeft = Enum.KeyCode.Left ,
SteerRight = Enum.KeyCode.Right ,
--Secondary Controls
Throttle2 = Enum.KeyCode.W ,
Brake2 = Enum.KeyCode.S ,
SteerLeft2 = Enum.KeyCode.A ,
SteerRight2 = Enum.KeyCode.D ,
--Manual Transmission
ShiftUp = Enum.KeyCode.E ,
ShiftDown = Enum.KeyCode.Q ,
Clutch = Enum.KeyCode.LeftShift ,
--Handbrake
PBrake = Enum.KeyCode.P ,
--Mouse Controls
MouseThrottle = Enum.UserInputType.MouseButton1 ,
MouseBrake = Enum.UserInputType.MouseButton2 ,
MouseClutch = Enum.KeyCode.W ,
MouseShiftUp = Enum.KeyCode.E ,
MouseShiftDown = Enum.KeyCode.Q ,
MousePBrake = Enum.KeyCode.LeftShift ,
--Controller Mapping
ContlrThrottle = Enum.KeyCode.ButtonR2 ,
ContlrBrake = Enum.KeyCode.ButtonL2 ,
ContlrSteer = Enum.KeyCode.Thumbstick1 ,
ContlrShiftUp = Enum.KeyCode.ButtonY ,
ContlrShiftDown = Enum.KeyCode.ButtonX ,
ContlrClutch = Enum.KeyCode.ButtonR1 ,
ContlrPBrake = Enum.KeyCode.ButtonL1 ,
ContlrToggleTMode = Enum.KeyCode.ButtonB ,
ContlrToggleTCS = Enum.KeyCode.DPadDown ,
ContlrToggleABS = Enum.KeyCode.ButtonL3 ,
}
|
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- |
local path
local waypoint
local chaseName = nil
function GetTorso(part)
local chars = game.Workspace:GetDescendants()
local chaseRoot = nil
local chaseTorso = nil
local chasePlr = nil
local chaseHuman = nil
local mag = SearchDistance
for i = 1, #chars do
chasePlr = chars[i]
if chasePlr:IsA'Model' and not chasePlr:FindFirstChild("Enemy") and chasePlr:FindFirstChild("Seen") then
chaseHuman = getHumanoid(chasePlr)
chaseRoot = chasePlr:FindFirstChild'HumanoidRootPart'
if chaseRoot ~= nil and chaseHuman ~= nil and chaseHuman.Health > 0 and not chaseHuman:FindFirstChild("Enemy") and not chasePlr:FindFirstChild("Helper") then
if (chaseRoot.Position - part).magnitude < mag then
chaseName = chasePlr.Name
chaseTorso = chaseRoot
mag = (chaseRoot.Position - part).magnitude
end
end
end
end
return chaseTorso
end
function GetPlayersBodyParts(t)
local torso = t
if torso then
local figure = torso.Parent
for _, v in pairs(figure:GetChildren())do
if v:IsA'Part' then
return v.Name
end
end
else
return "HumanoidRootPart"
end
end
|
--// Core |
return function()
local _G, game, script, getfenv, setfenv, workspace,
getmetatable, setmetatable, loadstring, coroutine,
rawequal, typeof, print, math, warn, error, pcall,
xpcall, select, rawset, rawget, ipairs, pairs,
next, Rect, Axes, os, tick, Faces, unpack, string, Color3,
newproxy, tostring, tonumber, Instance, TweenInfo, BrickColor,
NumberRange, ColorSequence, NumberSequence, ColorSequenceKeypoint,
NumberSequenceKeypoint, PhysicalProperties, Region3int16,
Vector3int16, elapsedTime, require, table, type, wait,
Enum, UDim, UDim2, Vector2, Vector3, Region3, CFrame, Ray, delay =
_G, game, script, getfenv, setfenv, workspace,
getmetatable, setmetatable, loadstring, coroutine,
rawequal, typeof, print, math, warn, error, pcall,
xpcall, select, rawset, rawget, ipairs, pairs,
next, Rect, Axes, os, tick, Faces, unpack, string, Color3,
newproxy, tostring, tonumber, Instance, TweenInfo, BrickColor,
NumberRange, ColorSequence, NumberSequence, ColorSequenceKeypoint,
NumberSequenceKeypoint, PhysicalProperties, Region3int16,
Vector3int16, elapsedTime, require, table, type, wait,
Enum, UDim, UDim2, Vector2, Vector3, Region3, CFrame, Ray, delay
local script = script
local service = service
local client = client
local Anti, Core, Functions, Process, Remote, UI, Variables
local function Init()
UI = client.UI;
Anti = client.Anti;
Core = client.Core;
Variables = client.Variables
Functions = client.Functions;
Process = client.Process;
Remote = client.Remote;
end
getfenv().client = nil
getfenv().service = nil
getfenv().script = nil
client.Core = {
Init = Init;
Name = script.Name;
Special = script.Name;
MakeGui = client.UI.Make;
GetGui = client.UI.Get;
RemoveGui = client.UI.Remove;
ScriptCache = {};
GetEvent = function()
if Core.RemoteEvent then
Core.RemoteEvent.Event:Disconnect()
Core.RemoteEvent.Security:Disconnect()
Core.RemoteEvent = nil
end
Core.RemoteEvent = {}
local rindex = 0
local firstSearch
local timer = 1
local prevTime = 0
local start = os.time()
local events = {}
local found
local function finishEvent(event)
if event then
local rFunc = event:FindFirstChildOfClass("RemoteFunction")
if rFunc then
Core.RemoteEvent.Object = event
Core.RemoteEvent.Function = rFunc
rFunc.OnClientInvoke = Process.Remote;
Core.RemoteEvent.FireServer = event.FireServer
Core.RemoteEvent.Event = event.OnClientEvent:Connect(Process.Remote)--]]
Core.RemoteEvent.Security = event.Changed:Connect(function(p)
if Core.RemoteEvent.Function then
Core.RemoteEvent.Function.OnClientInvoke = Process.Remote;
end
if p == "RobloxLocked" and Anti.RLocked(event) then
client.Kill("RemoteEvent Locked")
elseif not event or not event.Parent then
Core.GetEvent()
end
end)
rFunc.Changed:Connect(function()
rFunc.OnClientInvoke = Process.Remote;
end)
--SetFireServer(service.MetaFunc(event.FireServer))
if not Core.Key then
Remote.Fire(client.DepsName.."GET_KEY")
end
else
client.Kill("RemoteFunction not found")
end
else
client.Kill("RemoteEvent not found")
end
end
local function search()
local children = {}
for i,child in next,service.JointsService:GetChildren() do
if string.sub(child.Name,1,#client.RemoteName) == client.RemoteName then
table.insert(children, child)
end
end
for ind,e in next,events do
e.Event:Disconnect() events[ind] = nil
end
for i,child in next,children do
if not Anti.ObjRLocked(child) and child:IsA("RemoteEvent") and child:FindFirstChildOfClass("RemoteFunction") then
local index = rindex+1
rindex = index
if not events[child] then
local eventTab; eventTab = {
Event = child.OnClientEvent:Connect(function(com, ...)
if com == "TrustCheck" and select(1,...) == Core.Special and not found then
found = child
Core.RemoteEvent.Event = eventTab.Event
finishEvent(child)
for ind,e in next,events do
if ind ~= child then
e.Event:Disconnect() events[ind] = nil
end
end
elseif found and found == child then
--Process.Remote(com, ...)
end
end);
Object = child;
}
events[child] = eventTab
end
child:FireServer(client.Module, "TrustCheck")
end
end
end
repeat
if os.time() > prevTime then
prevTime = os.time()
timer = timer+1
if timer%10 == 0 or not firstSearch then
firstSearch = true
local event = service.JointsService:FindFirstChild(client.RemoteName)
if event then
found = event
finishEvent(event)
end
--search()
end
end
until found or not wait(0.01)
end;
LoadPlugin = function(plugin)
local plug = require(plugin)
local func = setfenv(plug,GetEnv(getfenv(plug)))
cPcall(func)
end;
LoadBytecode = function(str, env)
return require(client.Deps.FiOne)(str, env)
end;
LoadCode = function(str, env)
return Core.LoadBytecode(str, env)
end;
CheckClient = function()
if tick() - Core.LastUpdate >= 55 then
wait(math.random()) --// De-sync everyone's client checks
local returner = math.random()
local ret = Remote.Send("ClientCheck", {Sent = 0;--[[Remote.Sent]] Received = Remote.Received}, client.DepsName, returner)
--[[if ret and ret == returner then
Core.LastUpdate = tick()
else
client.Kill("Client check failed")
end--]]
end
end;
StartAPI = function()
local ScriptCache = Core.ScriptCache
local FiOne = client.Deps.FiOne
local Get = Remote.Get
local G_API = client.G_API
local Allowed_API_Calls = client.Allowed_API_Calls
local NewProxy = service.NewProxy
local MetaFunc = service.MetaFunc
local ReadOnly = service.ReadOnly
local StartLoop = service.StartLoop
local ReadOnly = service.ReadOnly
local UnWrap = service.UnWrap
local service = nil
local client = nil
local _G = _G
local setmetatable = setmetatable
local type = type
local print = print
local error = error
local pairs = pairs
local warn = warn
local next = next
local table = table
local rawset = rawset
local rawget = rawget
local getfenv = getfenv
local setfenv = setfenv
local require = require
local tostring = tostring
local client = client
local Routine = Routine
local cPcall = cPcall
--// Get Settings
local API_Special = {
}
setfenv(1,setmetatable({}, {__metatable = getmetatable(getfenv())}))
local API_Specific = {
API_Specific = {
Test = function()
print("We ran the api specific stuff")
end
};
Service = service;
}
local API = {
Access = ReadOnly({}, nil, nil, true);
--[[
Access = service.MetaFunc(function(...)
local args = {...}
local key = args[1]
local ind = args[2]
local targ
setfenv(1,setmetatable({}, {__metatable = getmetatable(getfenv())}))
if API_Specific[ind] then
targ = API_Specific[ind]
elseif client[ind] and client.Allowed_API_Calls[ind] then
targ = client[ind]
end
if client.G_Access and key == client.G_Access_Key and targ and client.Allowed_API_Calls[ind] then
if type(targ) == "table" then
return service.NewProxy {
__index = function(tab,inde)
if targ[inde] ~= nil and API_Special[inde] == nil or API_Special[inde] == true then
if targ[inde]~=nil and type(targ[inde]) == "table" and client.G_Access_Perms == "Read" then
return service.ReadOnly(targ[inde])
else
return targ[inde]
end
elseif API_Special[inde] == false then
error("Access Denied: "..tostring(inde))
else
error("Could not find "..tostring(inde))
end
end;
__newindex = function(tabl,inde,valu)
error("Read-only")
end;
__metatable = true;
}
end
else
error("Incorrect key or G_Access is disabled")
end
end);
--]]
Scripts = ReadOnly({
ExecutePermission = MetaFunc(function(code)
local exists;
for i,v in next,ScriptCache do
if UnWrap(v.Script) == getfenv(2).script then
exists = v
end
end
if exists and exists.noCache ~= true and (not exists.runLimit or (exists.runLimit and exists.Executions <= exists.runLimit)) then
exists.Executions = exists.Executions+1
return exists.Source, exists.Loadstring
end
local data = Get("ExecutePermission",UnWrap(getfenv(3).script), code, true)
if data and data.Source then
local module;
if not exists then
module = require(FiOne:Clone())
table.insert(ScriptCache,{
Script = getfenv(2).script;
Source = data.Source;
Loadstring = module;
noCache = data.noCache;
runLimit = data.runLimit;
Executions = data.Executions;
})
else
module = exists.Loadstring
exists.Source = data.Source
end
return data.Source, module
end
end);
ReportLBI = MetaFunc(function(scr, origin)
if origin == "Local" then
return true
end
end);
}, nil, nil, true);
}
AdonisGTable = NewProxy{
__index = function(tab,ind)
if ind == "Scripts" then
return API.Scripts
elseif G_API and Allowed_API_Calls.Client == true then
if type(API[ind]) == "function" then
return MetaFunc(API[ind])
else
return API[ind]
end
else
error("_G API is disabled")
end
end;
__newindex = function(tabl,ind,new)
error("Read-only")
end;
__metatable = "API";
}
if not _G.Adonis then
rawset(_G,"Adonis",AdonisGTable)
StartLoop("APICheck",1,function()
rawset(_G,"Adonis",AdonisGTable)
end, true)
end
end;
};
end
|
-- functions |
function onRunning(speed)
if isSeated then return end
if speed>0 then
pose = "Running"
else
pose = "Standing"
end
end
function onDied()
pose = "Dead"
end
function onJumping()
isSeated = false
pose = "Jumping"
end
function onClimbing()
pose = "Climbing"
end
function onGettingUp()
pose = "GettingUp"
end
function onFreeFall()
pose = "FreeFall"
end
function onFallingDown()
pose = "FallingDown"
end
function onSeated()
isSeated = true
pose = "Seated"
print("Seated")
end
function moveJump()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = 3.14
LeftShoulder.DesiredAngle = -3.14
RightHip.DesiredAngle = 0
LeftHip.DesiredAngle = 0
end
function moveFreeFall()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = 1
LeftShoulder.DesiredAngle = -1
RightHip.DesiredAngle = 0
LeftHip.DesiredAngle = 0
end
function moveClimb()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = -3.14
LeftShoulder.DesiredAngle = 3.14
RightHip.DesiredAngle = 0
LeftHip.DesiredAngle = 0
end
function moveSit()
print("Move Sit")
RightShoulder.MaxVelocity = 0.15
LeftShoulder.MaxVelocity = 0.15
RightShoulder.DesiredAngle = 3.14 /2
LeftShoulder.DesiredAngle = -3.14 /2
RightHip.DesiredAngle = 3.14 /2
LeftHip.DesiredAngle = -3.14 /2
end
function getTool()
kidTable = Figure:children()
if (kidTable ~= nil) then
numKids = #kidTable
for i=1,numKids do
if (kidTable[i].className == "Tool") then return kidTable[i] end
end
end
return nil
end
function getToolAnim(tool)
c = tool:children()
for i=1,#c do
if (c[i].Name == "toolanim" and c[i].className == "StringValue") then
return c[i]
end
end
return nil
end
function animateTool()
if (toolAnim == "None") then |
-- functions |
function onRunning(speed)
if isSeated then return end
if speed>0 then
pose = "Running"
else
pose = "Standing"
end
end
function onDied()
pose = "Dead"
end
function onJumping()
isSeated = false
pose = "Jumping"
end
function onClimbing()
pose = "Climbing"
end
function onGettingUp()
pose = "GettingUp"
end
function onFreeFall()
pose = "FreeFall"
end
function onFallingDown()
pose = "FallingDown"
end
function onSeated()
isSeated = true
pose = "Seated"
print("Seated")
end
function moveJump()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = 3.14
LeftShoulder.DesiredAngle = -3.14
RightHip.DesiredAngle = 0
LeftHip.DesiredAngle = 0
end
function moveFreeFall()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = 3.14
LeftShoulder.DesiredAngle = -3.14
RightHip.DesiredAngle = 0
LeftHip.DesiredAngle = 0
end
function moveClimb()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = -3.14
LeftShoulder.DesiredAngle = 3.14
RightHip.DesiredAngle = 0
LeftHip.DesiredAngle = 0
end
function moveSit()
print("Move Sit")
RightShoulder.MaxVelocity = 0.15
LeftShoulder.MaxVelocity = 0.15
RightShoulder.DesiredAngle = 3.14 /2
LeftShoulder.DesiredAngle = -3.14 /2
RightHip.DesiredAngle = 3.14 /2
LeftHip.DesiredAngle = -3.14 /2
end
function getTool()
kidTable = Figure:children()
if (kidTable ~= nil) then
numKids = #kidTable
for i=1,numKids do
if (kidTable[i].className == "Tool") then return kidTable[i] end
end
end
return nil
end
function getToolAnim(tool)
c = tool:children()
for i=1,#c do
if (c[i].Name == "toolanim" and c[i].className == "StringValue") then
return c[i]
end
end
return nil
end
function animateTool()
if (toolAnim == "None") then
RightShoulder.DesiredAngle = 1.57
return
end
if (toolAnim == "Slash") then
RightShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = 0
return
end
if (toolAnim == "Lunge") then
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightHip.MaxVelocity = 0.5
LeftHip.MaxVelocity = 0.5
RightShoulder.DesiredAngle = 1.57
LeftShoulder.DesiredAngle = 1.0
RightHip.DesiredAngle = 1.57
LeftHip.DesiredAngle = 1.0
return
end
end
function move(time)
local amplitude
local frequency
if (pose == "Jumping") then
moveJump()
return
end
if (pose == "FreeFall") then
moveFreeFall()
return
end
if (pose == "Climbing") then
moveClimb()
return
end
if (pose == "Seated") then
moveSit()
return
end
RightShoulder.MaxVelocity = 0.15
LeftShoulder.MaxVelocity = 0.15
if (pose == "Running") then
amplitude = 1
frequency = 9
else
amplitude = 0.1
frequency = 1
end
desiredAngle = amplitude * math.sin(time*frequency)
RightShoulder.DesiredAngle = desiredAngle
LeftShoulder.DesiredAngle = desiredAngle
RightHip.DesiredAngle = -desiredAngle
LeftHip.DesiredAngle = -desiredAngle
local tool = getTool()
if tool ~= nil then
animStringValueObject = getToolAnim(tool)
if animStringValueObject ~= nil 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
toolAnim = "None"
toolAnimTime = 0
end
end
|
--print("no building or player") |
target = nil
targetType = nil
lastLock = tick()
end
end -- end of wtd
end)
scanCoroutine()
|
------------------------------------------------ |
local screenGuis = {}
local freeCamEnabled = false
local stateRot = Vector2.new()
local panDeltaGamepad = Vector2.new()
local panDeltaMouse = Vector2.new()
local velSpring = Spring.new(7/9, 1/3, 1, Vector3.new())
local rotSpring = Spring.new(7/9, 1/3, 1, Vector2.new())
local fovSpring = Spring.new(2, 1/3, 1, 0)
local letterbox = LETTERBOX and CreateLetterBox()
local gp_x = 0
local gp_z = 0
local gp_l1 = 0
local gp_r1 = 0
local rate_fov = 0
local SpeedModifier = 1
|
-- LOCAL |
local Enum = {}
local enums = {}
Enum.enums = enums
|
--Tune |
OverheatSpeed = .2 --How fast the car will overheat
CoolingEfficiency = .03 --How fast the car will cool down
RunningTemp = 85 --In degrees
Fan = true --Cooling fan
FanTemp = 100 --At what temperature the cooling fan will activate
FanTempAlpha = 95 --At what temperature the cooling fan will deactivate
FanSpeed = .05 --How fast the car will cool down
FanVolume = .2 --Sound volume
BlowupTemp = 115 --At what temperature the engine will blow up
GUI = true --GUI temperature gauge
|
--Gear Ratios |
Tune.FinalDrive = 4.06 -- Gearing determines top speed and wheel torque
Tune.Ratios = { -- Higher ratio = more torque, Lower ratio = higher top speed
--[[Reverse]] 3.70 , -- Copy and paste a ratio to add a gear
--[[Neutral]] 0 , -- Ratios can also be deleted
--[[ 1 ]] 3.53 , -- Reverse, Neutral, and 1st gear are required
--[[ 2 ]] 2.04 ,
--[[ 3 ]] 1.38 ,
--[[ 4 ]] 1.03 ,
--[[ 5 ]] 0.81 ,
--[[ 6 ]] 0.64 ,
}
Tune.FDMult = 1.5 -- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
|
-- Libraries |
local Libraries = Tool:WaitForChild 'Libraries'
local Signal = require(Libraries:WaitForChild 'Signal')
local Make = require(Libraries:WaitForChild 'Make')
|
--Made by Luckymaxer |
Figure = script.Parent
Torso = Figure:WaitForChild("Torso") |
--Optimization-- |
local rad = math.rad
local Clamp = math.clamp
local NewCFrame = CFrame.new
local Angles = CFrame.Angles
local NewVector = Vector3.new
local CFLookAt = CFrame.lookAt
local EulerAngles = CFrame.fromEulerAnglesYXZ
function actions.aim()
local aimPos = NewVector()
local sightIndex = 50
status:set("weaponAimed",true)
myHuman.AutoRotate = false
bodyRotate.Enabled = true
myHuman.WalkSpeed = 10
while true do
local target = status:get("currentTarget")
if myHuman.Health <=0 or not target or not target.Parent then
break
elseif not status:get("m4Equipped") and not status:get("reloading") then
break
end
local target = status:get("currentTarget")
local dist = core.checkDist(target,myTorso)
local canSee = core.checkSight(target)
if not canSee then
sightIndex = sightIndex - 1
else
sightIndex = 50
end
if not canSee and myRoot.Velocity.Magnitude > 3 and sightIndex <= 0 then
local walkPoint = myHuman.WalkToPoint
local myPos = myRoot.Position
local dir = (NewVector(walkPoint.X,0,walkPoint.Z) - NewVector(myPos.X,0,myPos.Z)).Unit * 20
aimPos = myRoot.Position + NewVector(0,1.5,0) + dir
else
aimPos = target.Position + target.Velocity/(10 - dist/50)
end
local tilt = (myRoot.Position.Y - aimPos.Y) / (dist*0.04)
tilt = Clamp(tilt,-45,45)
rootJoint.C0 = rootJointOrg * EulerAngles(rad(tilt),0,0)
lHip.C0 = lHipOrg * EulerAngles(0,0,rad(-tilt))
rHip.C0 = rHipOrg * EulerAngles(0,0,rad(tilt))
xAxisAttach.WorldCFrame = CFLookAt(m4.Position,aimPos)
m4Hinge.Attachment0.WorldCFrame = NewCFrame(m4Hinge.Attachment0.WorldPosition) * EulerAngles(rad(0),rad(myRoot.Orientation.Y),0)
m4Hinge.TargetAngle = xAxisAttach.Orientation.X
headHinge.TargetAngle = xAxisAttach.Orientation.X
torsoHingeAttach.Position = torsoHingAttachOrgPos + NewVector(0,tilt/90,0)
yAxisAttach.WorldCFrame = CFLookAt(m4.Position,NewVector(
aimPos.X,
myRoot.Position.Y,
aimPos.Z
))
if status:get("m4Equipped") then
neck.C0 = NewCFrame(0,1,0) * Angles(-1.5 + rad(xAxisAttach.Orientation.X),rad(15),rad(180))
else
neck.C0 = NewCFrame(0,1,0) * Angles(-1.5 + rad(xAxisAttach.Orientation.X),0,rad(180))
end
runService.Heartbeat:Wait()
runService.Heartbeat:Wait()
end
actions.resetHead()
bodyRotate.Enabled = false
myHuman.WalkSpeed = 16
myHuman.AutoRotate = true
rootJoint.C0 = rootJointOrg
lHip.C0 = lHipOrg
rHip.C0 = rHipOrg
status:set("weaponAimed",false)
end
function actions.reload()
status:set("weaponAimed",false)
reloadSound:Play()
status:set("reloading",true)
actions.yieldM4()
m4Weld.Part0 = nil
m4.CFrame = lArm.CFrame * NewCFrame(0.5,-0.2,0) * Angles(rad(-90),rad(180),rad(0))
m4Weld.Part0 = lArm
reloadAnimation:Play()
reloadAnimation:AdjustSpeed(3)
wait(0.2)
local fakeMag = magazine:Clone()
fakeMag.CanCollide = true
fakeMag.Parent = workspace
debrisService:AddItem(fakeMag,4)
magazine.Transparency = 1
reloadAnimation.Stopped:Wait()
magazine.Transparency = 0
status:set("reloading",false)
status:set("mag",marine.Settings.MagSize.Value)
actions.drawM4()
end
function actions.drawM4()
actions.yieldKnife()
if not status:get("m4Equipped") and not status:get("reloading") then
status:set("m4Equipped",true)
status:set("m4Lowered",false)
m4.Equip:Play()
xAxisAttach.CFrame = myTorso.CFrame
--M4 Setup
m4Weld.Part0 = nil
m4.CFrame = myRoot.CFrame * NewCFrame(0.3,0.85,1.3) * Angles(rad(-180),rad(180),rad(0))
m4HingeAttach.WorldPosition = torsoHingeAttach.WorldPosition
m4Hinge.Enabled = true
--Right Arm Setup
rShoulder.Part1 = nil
rArmWeld.Part1 = nil --x 1.25
rArmWeld.Enabled = false
rArm.CFrame = m4.CFrame * NewCFrame(-0.6,-0.5,-0.5) * Angles(rad(-80),rad(-180),rad(-15))
rArmWeld.Part1 = rArm
rArmWeld.Enabled = true
--Left Arm Setup
lShoulder.Part1 = nil
lArmWeld.Part1 = nil
lArm.CFrame = m4.CFrame * NewCFrame(0.7,-0.3,0) * Angles(rad(-90),rad(183),rad(28)) --x84
lArmWeld.Part1 = lArm
wait(0.5)
end
end
function actions.yieldM4()
if status:get("m4Equipped") or status:get("m4Lowered") then
status:set("m4Equipped",false)
status:set("weaponAimed",false)
status:set("m4Lowered",false)
m4.Equip:Play()
--Right Arm setup
rArmWeld.Part1 = nil
rShoulder.Part1 = rArm
--Left Arm Setup
lArmWeld.Part1 = nil
lShoulder.Part1 = lArm
--M4 Setup
m4Weld.Part0 = nil
m4Hinge.Enabled = false
m4.CFrame = myTorso.CFrame * NewCFrame(0,0,0.7) * Angles(rad(-90),rad(-135),rad(270))
m4Weld.Part0 = myTorso
end
end
function actions.lowerM4()
if not status:get("m4Lowered") and status:get("m4Equipped") and not status:get("reloading") then
status:set("m4Equipped",false)
status:set("m4Lowered",true)
m4.Equip:Play()
--M4 Setup
m4Hinge.Enabled = false
m4Weld.Part0 = nil
m4.CFrame = myTorso.CFrame * NewCFrame(-0.2,-1,-1) * Angles(rad(75),rad(55),rad(-75)) -- z 35 x 0
m4Weld.Part0 = myTorso
--Right Arm Setup
rShoulder.Part1 = nil
rArmWeld.Part1 = nil
rArm.CFrame = myRoot.CFrame * NewCFrame(1.3,-0.2,-0.3) * Angles(rad(30),rad(14),rad(-25))
rArmWeld.Part1 = rArm
--Left Arm Setup
lShoulder.Part1 = nil
lArmWeld.Part1 = nil
lArm.CFrame = myRoot.CFrame * NewCFrame(-1.3,-0.1,-0.3) * Angles(rad(40),rad(-3),rad(10)) --x84
lArmWeld.Part1 = lArm
wait(0.5)
end
end
local knife = marine.Knife
function actions.drawKnife()
if not status:get("knifeEquipped") then
actions.yieldM4()
knife.Equip:Play()
status:set("knifeEquipped",true)
knife.Weld.Part0 = nil
knife.CFrame = rArm.CFrame * NewCFrame(0,-1,-1) * Angles(rad(90),rad(180),rad(180))
knife.Weld.Part0 = rArm
end
end
function actions.yieldKnife()
if status:get("knifeEquipped") then
status:set("knifeEquipped",false)
knife.Weld.Part0 = nil
knife.CFrame = myTorso.CFrame * NewCFrame(-1,-1,0.5) * Angles(rad(-65),0,rad(180))
knife.Weld.Part0 = myTorso
end
end
function actions.yieldWeapons()
actions.yieldKnife()
actions.yieldM4()
end
function actions.resetHead()
tweenService:Create(neck,TweenInfo.new(0.5),{C0 = NewCFrame(0,1,0) * Angles(rad(-90),0,rad(180))}):Play()
end
local faces = myHead.Faces
function actions.updateFace(newStatus,recovered)
if status:get("mood") ~= "Dead" then
if status:get("mood") ~= "Hurt" or recovered or newStatus == "Dead" then
local currentFace = status:get("currentFace")
currentFace.Parent = faces
status:set("currentFace",faces["face"..newStatus])
status:get("currentFace").Parent = myHead
end
status:set("mood",newStatus)
end
end
return actions
|
--[[ Public API ]] | --
function MasterControl:Init()
local renderStepFunc = function()
if LocalPlayer and LocalPlayer.Character then
local humanoid = getHumanoid()
if not humanoid then return end
if humanoid and not humanoid.PlatformStand and isJumping then
humanoid.Jump = isJumping
end
moveFunc(LocalPlayer, moveValue, true)
end
end
local success = pcall(function() RunService:BindToRenderStep("MasterControlStep", Enum.RenderPriority.Input.Value, renderStepFunc) end)
if not success then
if RenderSteppedCon then return end
RenderSteppedCon = RunService.RenderStepped:connect(renderStepFunc)
end
end
function MasterControl:Disable()
local success = pcall(function() RunService:UnbindFromRenderStep("MasterControlStep") end)
if not success then
if RenderSteppedCon then
RenderSteppedCon:disconnect()
RenderSteppedCon = nil
end
end
moveValue = Vector3.new(0,0,0)
isJumping = false
end
function MasterControl:AddToPlayerMovement(playerMoveVector)
moveValue = Vector3.new(moveValue.X + playerMoveVector.X, moveValue.Y + playerMoveVector.Y, moveValue.Z + playerMoveVector.Z)
end
function MasterControl:SetIsJumping(jumping)
isJumping = jumping
end
function MasterControl:DoJump()
local humanoid = getHumanoid()
if humanoid then
humanoid.Jump = true
end
end
return MasterControl
|
--[=[
@param motor Enum.VibrationMotor
@return boolean
Returns `true` if the given motor is supported.
```lua
-- Pulse the trigger (e.g. shooting a weapon), but fall back to
-- the large motor if not supported:
local motor = Enum.VibrationMotor.Large
if gamepad:IsMotorSupported(Enum.VibrationMotor.RightTrigger) then
motor = Enum.VibrationMotor.RightTrigger
end
gamepad:PulseMotor(motor, 1, 0.1)
```
]=] |
function Gamepad:IsMotorSupported(motor: Enum.VibrationMotor): boolean
return HapticService:IsMotorSupported(self._gamepad, motor)
end
|
-- unlocked |
["Smile"] = {id = "rbxassetid://144080495", locked = false, image = "https://www.roblox.com/asset-thumbnail/image?assetId=144080495&width=420&height=420&format=png"},
["Cunning"] = {"rbxassetid://21635489", locked = false, image = "https://www.roblox.com/asset-thumbnail/image?assetId=21635489&width=420&height=420&format=png"},
["Laughing"] = {"rbxassetid://26424652", locked = false, image = "https://www.roblox.com/asset-thumbnail/image?assetId=26424652&width=420&height=420&format=png"},
["Chill"] = {"rbxassetid://7074749", locked = false, image = "https://www.roblox.com/asset-thumbnail/image?assetId=7074749&width=420&height=420&format=png"},
["Unamused"] = {"rbxassetid://20418518", locked = false, image = "https://www.roblox.com/asset-thumbnail/image?assetId=20418518&width=420&height=420&format=png"},
["Freckles"] = {"rbxassetid://12145059", locked = false, image = "https://www.roblox.com/asset-thumbnail/image?assetId=12145059&width=420&height=420&format=png"},
["Beardy"] = {"rbxassetid://110287880", locked = false, image = "https://www.roblox.com/asset-thumbnail/image?assetId=110287880&width=420&height=420&format=png"},
},
hair = {
["Blonde Dream"] = {id = "rbxassetid://185812332", locked = true, image = "https://www.roblox.com/asset-thumbnail/image?assetId=185812332&width=420&height=420&format=png"},
["Blonde Spiked"] = {id = "rbxassetid://376524487", locked = true, image = "https://www.roblox.com/asset-thumbnail/image?assetId=376524487&width=420&height=420&format=png"},
["New Shaggy Black"] = {id = "rbxassetid://1191118998", locked = true, image = "https://www.roblox.com/asset-thumbnail/image?assetId=1191118998&width=420&height=420&format=png"},
["Brunette Ponytail"] = {id = "rbxassetid://2042026822", locked = true, image = "https://www.roblox.com/asset-thumbnail/image?assetId=2042026822&width=420&height=420&format=png"},
["Blonde Anime"] = {id = "rbxassetid://185812297", locked = true, image = "https://www.roblox.com/asset-thumbnail/image?assetId=185812297&width=420&height=420&format=png"},
["Noob Blonde"] = {id = "rbxassetid://376526888", locked = true, image = "https://www.roblox.com/asset-thumbnail/image?assetId=376526888&width=420&height=420&format=png"},
["Long Hair"] = {id = "rbxassetid://12519986", locked = true, image = "https://www.roblox.com/asset-thumbnail/image?assetId=12519986&width=420&height=420&format=png"},
["Chestnut Style"] = {id = "rbxassetid://212967757", locked = true, image = "https://www.roblox.com/asset-thumbnail/image?assetId=212967757&width=420&height=420&format=png"},
["Black Ponytail"] = {id = "rbxassetid://376527350", locked = true, image = "https://www.roblox.com/asset-thumbnail/image?assetId=376527350&width=420&height=420&format=png"},
["New Shaggy"] = {id = "rbxassetid://417457139", locked = true, image = "https://www.roblox.com/asset-thumbnail/image?assetId=417457139&width=420&height=420&format=png"},
["Lovely Blonde"] = {id = "rbxassetid://295457258", locked = true, image = "https://www.roblox.com/asset-thumbnail/image?assetId=295457258&width=420&height=420&format=png"},
["Telamon"] = {id = "rbxassetid://31312357", locked = true, image = "https://www.roblox.com/asset-thumbnail/image?assetId=31312357&width=420&height=420&format=png"},
["Black Manga"] = {id = "rbxassetid://398672920", locked = true, image = "https://www.roblox.com/asset-thumbnail/image?assetId=398672920&width=420&height=420&format=png"},
["Black Dreamy"] = {id = "rbxassetid://295456068", locked = true, image = "https://www.roblox.com/asset-thumbnail/image?assetId=295456068&width=420&height=420&format=png"},
["Brown Scene"] = {id = "rbxassetid://323476364", locked = true, image = "https://www.roblox.com/asset-thumbnail/image?assetId=323476364&width=420&height=420&format=png"},
["Man Bun"] = {id = "rbxassetid://343584973", locked = true, image = "https://www.roblox.com/asset-thumbnail/image?assetId=343584973&width=420&height=420&format=png"},
["Beautiful Adurite"] = {id = "rbxassetid://1191145114", locked = true, image = "https://www.roblox.com/asset-thumbnail/image?assetId=1191145114&width=420&height=420&format=png"},
["Blue Charmer"] = {id = "rbxassetid://376809157", locked = true, image = "https://www.roblox.com/asset-thumbnail/image?assetId=376809157&width=420&height=420&format=png"},
["Red Charmer"] = {id = "rbxassetid://417457737", locked = true, image = "https://www.roblox.com/asset-thumbnail/image?assetId=417457737&width=420&height=420&format=png"},
["Auburn Winner"] = {id = "rbxassetid://74891249", locked = true, image = "https://www.roblox.com/asset-thumbnail/image?assetId=74891249&width=420&height=420&format=png"},
["Blonde Charmer"] = {id = "rbxassetid://80921949", locked = true, image = "https://www.roblox.com/asset-thumbnail/image?assetId=80921949&width=420&height=420&format=png"},
["Burning Hair"] = {id = "rbxassetid://2566043868", locked = true, image = "https://www.roblox.com/asset-thumbnail/image?assetId=2566043868&width=420&height=420&format=png"},
["Purple Ponytail"] = {id = "rbxassetid://398673423", locked = true, image = "https://www.roblox.com/asset-thumbnail/image?assetId=398673423&width=420&height=420&format=png"},
["Blonde Ponytail"] = {id = "rbxassetid://398673196", locked = true, image = "https://www.roblox.com/asset-thumbnail/image?assetId=398673196&width=420&height=420&format=png"},
["Red Ponytail"] = {id = "rbxassetid://1513252656", locked = true, image = "https://www.roblox.com/asset-thumbnail/image?assetId=1513252656&width=420&height=420&format=png"},
["Candy Apple Hair"] = {id = "rbxassetid://417457909", locked = true, image = "https://www.roblox.com/asset-thumbnail/image?assetId=417457909&width=420&height=420&format=png"},
["Trecky Hair"] = {id = "rbxassetid://32278814", locked = true, image = "https://www.roblox.com/asset-thumbnail/image?assetId=32278814&width=420&height=420&format=png"},
["Teal Anime Hair"] = {id = "rbxassetid://835064879", locked = true, image = "https://www.roblox.com/asset-thumbnail/image?assetId=835064879&width=420&height=420&format=png"},
["Red Anime Hair"] = {id = "rbxassetid://175136000", locked = true, image = "https://www.roblox.com/asset-thumbnail/image?assetId=175136000&width=420&height=420&format=png"},
["Black Faux Hawk"] = {id = "rbxassetid://81708953", locked = true, image = "https://www.roblox.com/asset-thumbnail/image?assetId=81708953&width=420&height=420&format=png"},
["Normal Boy Hair"] = {id = "rbxassetid://13477818", locked = true, image = "https://www.roblox.com/asset-thumbnail/image?assetId=13477818&width=420&height=420&format=png"},
["Charming Brown Hair"] = {id = "rbxassetid://83013207", locked = true, image = "https://www.roblox.com/asset-thumbnail/image?assetId=83013207&width=420&height=420&format=png"},
["Fro"] = {id = "rbxassetid://12270336", locked = true, image = "https://www.roblox.com/asset-thumbnail/image?assetId=12270336&width=420&height=420&format=png"},
["Auburn Bun"] = {id = "rbxassetid://81688919", locked = true, image = "https://www.roblox.com/asset-thumbnail/image?assetId=81688919&width=420&height=420&format=png"},
["Blonde Bun"] = {id = "rbxassetid://77800073", locked = true, image = "https://www.roblox.com/asset-thumbnail/image?assetId=77800073&width=420&height=420&format=png"},
["Amber Bun"] = {id = "rbxassetid://25308317", locked = true, image = "https://www.roblox.com/asset-thumbnail/image?assetId=25308317&width=420&height=420&format=png"},
["Black Bun"] = {id = "rbxassetid://80922251", locked = true, image = "https://www.roblox.com/asset-thumbnail/image?assetId=80922251&width=420&height=420&format=png"},
["Brown Charm"] = {id = "rbxassetid://376548738", locked = true, image = "https://www.roblox.com/asset-thumbnail/image?assetId=376548738&width=420&height=420&format=png"},
["True Blue"] = {id = "rbxassetid://451221329", locked = true, image = "https://www.roblox.com/asset-thumbnail/image?assetId=451221329&width=420&height=420&format=png"},
["Pal Hair"] = {id = "rbxassetid://63690008", locked = true, image = "https://www.roblox.com/asset-thumbnail/image?assetId=63690008&width=420&height=420&format=png"},
["Beautiful Space Hair"] = {id = "rbxassetid://564449640", locked = true, image = "https://www.roblox.com/asset-thumbnail/image?assetId=564449640&width=420&height=420&format=png"},
["Super Puple Swoop"] = {id = "rbxassetid://241544111", locked = true, image = "https://www.roblox.com/asset-thumbnail/image?assetId=241544111&width=420&height=420&format=png"},
["Long Brown Hair"] = {id = "rbxassetid://301818464", locked = true, image = "https://www.roblox.com/asset-thumbnail/image?assetId=301818464&width=420&height=420&format=png"}, |
-- you can mess with these settings |
CanToggleMouse = {allowed = true; activationkey = Enum.KeyCode.F;} -- lets you move your mouse around in firstperson
CanViewBody = true -- whether you see your body
Sensitivity = 0.6 -- anything higher would make looking up and down harder; recommend anything between 0~1
Smoothness = 0.05 -- recommend anything between 0~1
FieldOfView = 70 -- fov
HeadOffset = CFrame.new(0,0.7,0) -- how far your camera is from your head
local cam = game.Workspace.CurrentCamera
local player = players.LocalPlayer
local m = player:GetMouse()
m.Icon = "http://www.roblox.com/asset/?id=569021388" -- replaces mouse icon
local character = player.Character or player.CharacterAdded:wait()
local human = character.Humanoid
local humanoidpart = character.HumanoidRootPart
local head = character:WaitForChild("Head")
local CamPos,TargetCamPos = cam.CoordinateFrame.p,cam.CoordinateFrame.p
local AngleX,TargetAngleX = 0,0
local AngleY,TargetAngleY = 0,0
local running = true
local freemouse = false
local defFOV = FieldOfView
local w, a, s, d, lshift = false, false, false, false, false
|
--CFrame.new ( number x, number y, number z, number R00, number R01, number R02, number R10, number R11, number R12, number R20, number R21, number R22 )
--CFrame:GetComponents ( ) x, y, z, R00, R01, R02, R10, R11, R12, R20, R21, R22, |
local comps = {}
local cf = CFrame.new
local CFrameEasing = {}
local easing = require(script.Easing)
for key, val in pairs(easing) do
CFrameEasing[key] = function(b, g, t, d, ...)
local bX, bY, bZ, bR00, bR01, bR02, bR10, bR11, bR12, bR20, bR21, bR22 = b:GetComponents()
local gX, gY, gZ, gR00, gR01, gR02, gR10, gR11, gR12, gR20, gR21, gR22 = g:GetComponents()
return cf(
easing[key](t, bX, gX - bX, d, ...), easing[key](t, bY, gY - bY, d, ...), easing[key](t, bZ, gZ - bZ, d, ...), --X, Y, Z
easing[key](t, bR00, gR00 - bR00, d, ...), easing[key](t, bR01, gR01 - bR01, d, ...), easing[key](t, bR02, gR02 - bR02, d, ...), --number R00, number R01, number R02
easing[key](t, bR10, gR10 - bR10, d, ...), easing[key](t, bR11, gR11 - bR11, d, ...), easing[key](t, bR12, gR12 - bR12, d, ...), --number R10, number R11, number R12
easing[key](t, bR20, gR20 - bR20, d, ...), easing[key](t, bR21, gR21 - bR21, d, ...), easing[key](t, bR22, gR22 - bR22, d, ...) --number R20, number R21, number R22
)
end
end
return CFrameEasing
|
--////////////////////////////// Include
--////////////////////////////////////// |
local ChatConstants = require(replicatedModules:WaitForChild("ChatConstants"))
local Util = require(modulesFolder:WaitForChild("Util"))
local ChatLocalization = nil
pcall(function() ChatLocalization = require(game:GetService("Chat").ClientChatModules.ChatLocalization :: any) end)
ChatLocalization = ChatLocalization or {}
if not ChatLocalization.FormatMessageToSend or not ChatLocalization.LocalizeFormattedMessage then
function ChatLocalization:FormatMessageToSend(key,default) return default end
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,1,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,1,true)
end
end)
script.Parent.MouseButton1Click:connect(function()
if car.Body.Lights.L.L.L.Enabled == false and car.Body.Lights.H.L.L.Enabled == false then
script.Parent.BackgroundColor3 = Color3.new(0,255/255,0)
script.Parent.TextStrokeColor3 = Color3.new(0,255/255,0)
car.Body.Lights.R.L.L.Enabled = true
car.Body.Lights.PLATE.L.GUI.Enabled = true
car.Body.Lights.light1.light1.light.Enabled = true
car.Body.Lights.light2.light1.light.Enabled = true
for index, child in pairs(car.Body.Lights.L:GetChildren()) do
child.Material = Enum.Material.Neon
child.L.Enabled = true
end
for index, child in pairs(car.Body.Lights.R:GetChildren()) do
child.Material = Enum.Material.Neon
end
for index, child in pairs(car.Body.Lights.H:GetChildren()) do
child.Material = Enum.Material.SmoothPlastic
child.L.Enabled = false
end
elseif car.Body.Lights.L.L.L.Enabled == true and car.Body.Lights.H.L.L.Enabled == false then
script.Parent.BackgroundColor3 = Color3.new(0,0,255/255)
script.Parent.TextStrokeColor3 = Color3.new(0,0,255/255)
car.Body.Lights.R.L.L.Enabled = true
car.Body.Lights.PLATE.L.GUI.Enabled = true
for index, child in pairs(car.Body.Lights.L:GetChildren()) do
child.Material = Enum.Material.Neon
child.L.Enabled = true
end
for index, child in pairs(car.Body.Lights.R:GetChildren()) do
child.Material = Enum.Material.Neon
end
for index, child in pairs(car.Body.Lights.H:GetChildren()) do
child.Material = Enum.Material.Neon
child.L.Enabled = true
end
elseif car.Body.Lights.L.L.L.Enabled == true and car.Body.Lights.H.L.L.Enabled == true then
script.Parent.BackgroundColor3 = Color3.new(0,0,0)
script.Parent.TextStrokeColor3 = Color3.new(0,0,0)
car.Body.Lights.R.L.L.Enabled = false
car.Body.Lights.PLATE.L.GUI.Enabled = false
car.Body.Lights.light1.light1.light.Enabled = false
car.Body.Lights.light2.light1.light.Enabled = false
for index, child in pairs(car.Body.Lights.L:GetChildren()) do
child.Material = Enum.Material.SmoothPlastic
child.L.Enabled = false
end
for index, child in pairs(car.Body.Lights.R:GetChildren()) do
child.Material = Enum.Material.SmoothPlastic
end
for index, child in pairs(car.Body.Lights.H:GetChildren()) do
child.Material = Enum.Material.SmoothPlastic
child.L.Enabled = false
end
end
end)
script.Parent.Parent.Parent.Values.Brake.Changed:connect(function()
if script.Parent.Parent.Parent.Values.Brake.Value ~= 1 and script.Parent.Parent.Parent.IsOn.Value then
for index, child in pairs(car.Body.Lights.B:GetChildren()) do
child.Material = Enum.Material.SmoothPlastic
end
car.Body.Lights.B.L.L.Enabled = false
else
for index, child in pairs(car.Body.Lights.B:GetChildren()) do
child.Material = Enum.Material.Neon
end
car.Body.Lights.B.L.L.Enabled = true
end
end)
script.Parent.Parent.Parent.Values.Gear.Changed:connect(function()
if script.Parent.Parent.Parent.Values.Gear.Value == -1 then
for index, child in pairs(car.Body.Lights.Rev:GetChildren()) do
child.Material = Enum.Material.Neon
car.DriveSeat.Reverse:Play()
end
else
for index, child in pairs(car.Body.Lights.Rev:GetChildren()) do
child.Material = Enum.Material.SmoothPlastic
car.DriveSeat.Reverse:Stop()
end
end
end)
mouse.KeyDown:connect(function(key)
if key=="l" then
if car.Body.Intlight.L.Enabled == false then
car.Body.Intlight.L.Enabled = true
else
car.Body.Intlight.L.Enabled = false
end
end
end)
while wait() do
if (car.DriveSeat.Velocity.magnitude/40)+0.300 < 1.3 then
car.DriveSeat.Reverse.Pitch = (car.DriveSeat.Velocity.magnitude/40)+0.300
car.DriveSeat.Reverse.Volume = (car.DriveSeat.Velocity.magnitude/150)
else
car.DriveSeat.Reverse.Pitch = 1.3
car.DriveSeat.Reverse.Volume = .2
end
end
|
-- Adds sounds to the GUI buttons.
--
-- ForbiddenJ |
Sound = script.Parent
GuiTarget = script.Parent.Parent
ButtonBindings = {} -- A table of MouseButton1Down connections indexed by their buttons.
function TryBindButton(object)
if object:IsA("GuiButton") then
ButtonBindings[object] = object.MouseButton1Down:Connect(function()
Sound:Play()
end)
end
end
for i, item in ipairs(GuiTarget:GetDescendants()) do
TryBindButton(item)
end
GuiTarget.DescendantAdded:Connect(TryBindButton)
GuiTarget.DescendantRemoving:Connect(function(object)
if ButtonBindings[object] ~= nil then
ButtonBindings[object]:Disconnect()
ButtonBindings[object] = nil
end
end)
|
--[[game.ReplicatedStorage.SpawnRE.OnServerEvent:Connect(function(plr, name)
for i,v in pairs(game.ReplicatedStorage.Characters:GetChildren()) do
if v.Name == name then
local clone = v:Clone()
clone.Parent = plr
end
end
plr:LoadCharacter()
end)
]] | |
--// Bar Colors // |
local Stamina_Red_Color = Color3.new(255/255, 28/255, 0/255)
local Stamina_Yellow_Color = Color3.new(250/255, 235/255, 0)
local Stamina_Green_Color = Color3.new(27/255, 252/255, 107/255)
local Util = {}
do
function Util.IsTouchDevice()
return UserInputService.TouchEnabled
end
function Util.Create(instanceType)
return function(data)
local obj = Instance.new(instanceType)
for k, v in pairs(data) do
if type(k) == 'number' then
v.Parent = obj
else
obj[k] = v
end
end
return obj
end
end
function Util.Clamp(low, high, input)
return math.max(low, math.min(high, input))
end
function Util.DisconnectEvent(conn)
if conn then
conn:disconnect()
end
return nil
end
function Util.SetGUIInsetBounds(x1, y1, x2, y2)
GuiService:SetGlobalGuiInset(x1, y1, x2, y2)
end
local humanoidCache = {}
function Util.FindPlayerHumanoid(player)
local character = player and player.Character
if character then
local resultHumanoid = humanoidCache[player]
if resultHumanoid and resultHumanoid.Parent == character then
return resultHumanoid
else
humanoidCache[player] = nil -- Bust Old Cache
for _, child in pairs(character:GetChildren()) do
if child:IsA('Humanoid') then
humanoidCache[player] = child
return child
end
end
end
end
end
end
UIS.InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.LeftShift or key.KeyCode == Enum.KeyCode.RightShift then
if (Sprinting == false) and (Stamina.Value > StaminaReductionRate) then
TS:Create(plr.Character.Humanoid, TweenInfo.new(3), {WalkSpeed = SprintSpeed}):Play()
Sprinting = true
repeat
wait(StaminaReductionDelay)
Stamina.Value = Stamina.Value - StaminaReductionRate
until (Sprinting == false)
TS:Create(plr.Character.Humanoid, TweenInfo.new(1.2), {WalkSpeed = OriginalWalkSpeed}):Play()
end
end
end)
UserInputService.InputEnded:connect(function(inputkey)
if inputkey.KeyCode == Enum.KeyCode.LeftShift then
if Sprinting == true then
Sprinting = false
TS:Create(plr.Character.Humanoid, TweenInfo.new(1.2), {WalkSpeed = OriginalWalkSpeed}):Play()
end
end
end)
if UserInputService.TouchEnabled then
StaminaButton.Visible = true
end
StaminaButton.MouseButton1Down:Connect(function()
if (Sprinting == false) and (Stamina.Value > StaminaReductionRate) then
Border.Visible = false
Sprinting = true
TS:Create(plr.Character.Humanoid, TweenInfo.new(3), {WalkSpeed = SprintSpeed}):Play()
repeat
wait(StaminaReductionDelay)
Stamina.Value = Stamina.Value - StaminaReductionRate
until (Sprinting == false)
TS:Create(plr.Character.Humanoid, TweenInfo.new(1.2), {WalkSpeed = OriginalWalkSpeed}):Play()
elseif Sprinting == true and Stamina.Value < 100 then
Border.Visible = false
Sprinting = false
TS:Create(plr.Character.Humanoid, TweenInfo.new(1.2), {WalkSpeed = OriginalWalkSpeed}):Play()
end
end)
Stamina.Changed:connect(function(value)
if (value < StaminaReductionRate) then
Sprinting = false
end
local Bar = script.Parent:WaitForChild('Frame_Bar')
local Fill = script.Parent.Frame_Bar:WaitForChild('Frame_BarFill')
Fill:TweenSize(UDim2.new(value/100,0,1,0), Enum.EasingDirection.Out, Enum.EasingStyle.Quart, .5, true)
local healthColorToPosition = {
[Vector3.new(Stamina_Red_Color.r, Stamina_Red_Color.g, Stamina_Red_Color.b)] = 0.1;
[Vector3.new(Stamina_Yellow_Color.r, Stamina_Yellow_Color.g, Stamina_Yellow_Color.b)] = 0.5;
[Vector3.new(Stamina_Green_Color.r, Stamina_Green_Color.g, Stamina_Green_Color.b)] = 0.8;
}
local min = 0.1
local minColor = Stamina_Red_Color
local max = 0.8
local maxColor = Stamina_Green_Color
local function HealthbarColorTransferFunction(staminaPercent)
if staminaPercent < min then
return minColor
elseif staminaPercent > max then
return maxColor
end
local numeratorSum = Vector3.new(0,0,0)
local denominatorSum = 0
for colorSampleValue, samplePoint in pairs(healthColorToPosition) do
local distance = staminaPercent - samplePoint
if distance == 0 then
return Color3.new(colorSampleValue.x, colorSampleValue.y, colorSampleValue.z)
else
local wi = 1 / (distance*distance)
numeratorSum = numeratorSum + wi * colorSampleValue
denominatorSum = denominatorSum + wi
end
end
local result = numeratorSum / denominatorSum
return Color3.new(result.x, result.y, result.z)
end
local staminaPercent = Stamina.Value / 100
if Stamina.Value == 2 then
Border.Visible = false
end
staminaPercent = Util.Clamp(0, 1, staminaPercent)
local staminaColor = HealthbarColorTransferFunction(staminaPercent)
Fill.BackgroundColor3 = staminaColor
end)
while true do
wait(RegenerateDelay)
if (Sprinting == false) and (Stamina.Value < 100) then
Stamina.Value = Stamina.Value + RegenerateValue
end
end
|
--[ Hooks ]--
-- Controls |
Mouse.KeyDown:connect(function(Key)
if (Hold ~= nil) then return end
if (string.upper(Key) ~= "Z") and (string.lower(Key) ~= " ") then return end
Hold = true
if (Torso:FindFirstChild("LegWeld") == nil) and (string.lower(Key) ~= " ") then
-- Right Leg
RH.Part1 = nil
CreateWeld(RL, CFrame.new(-0.4, 1.25, 0.5) * CFrame.fromEulerAnglesXYZ(math.rad(90),-0.25,0))
-- Left Leg
LH.Part1 = nil
CreateWeld(LL, CFrame.new(0.4, 1.25, 0.5) * CFrame.fromEulerAnglesXYZ(math.rad(90),0.25,0))
-- Lower Character
RJ.C0 = CFrame.new(0, -2, 0) * CFrame.Angles(0, 0, 0)
RJ.C1 = CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0)
-- Slow Walk Speed
Humanoid.CameraOffset = Vector3.new(0, -2, 0)
Humanoid.WalkSpeed = 4
else
StandUp()
Humanoid.WalkSpeed = 16
-- Normal Walk Speed
if Humanoid.CameraOffset == Vector3.new(0,1.25,0) then
Humanoid.CameraOffset = Vector3.new(0, 0, 0)
Humanoid.WalkSpeed = 16
end
end
wait(0.5)
Hold = nil
end)
|
-- Domukas3123 click regen script
-- just place the button to the model |
location = script.Parent.Parent.Parent
regen = script.Parent.Parent
save = regen:clone()
function onClicked()
back = save:clone()
back.Parent = location
back:MakeJoints()
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
|
--This is SML879's Close Button |
print("Close button loaded")
button = script.Parent
window = script.Parent.Parent.Parent.Parent
function onClicked(GUI)
window:remove()
end
script.Parent.MouseButton1Click:connect(onClicked)
|
-------- OMG HAX |
r = game:service("RunService")
local damage = 5
local slash_damage = 13
local lunge_damage = 17
sword = script.Parent.Handle
Tool = script.Parent
local SlashSound = Instance.new("Sound")
SlashSound.SoundId = "rbxasset://sounds\\swordslash.wav"
SlashSound.Parent = sword
SlashSound.Volume = .7
local LungeSound = Instance.new("Sound")
LungeSound.SoundId = "rbxasset://sounds\\swordlunge.wav"
LungeSound.Parent = sword
LungeSound.Volume = .6
local UnsheathSound = Instance.new("Sound")
UnsheathSound.SoundId = "rbxasset://sounds\\unsheath.wav"
UnsheathSound.Parent = sword
UnsheathSound.Volume = 1
function blow(hit)
local humanoid = hit.Parent:findFirstChild("Humanoid")
local vCharacter = Tool.Parent
local vPlayer = game.Players:playerFromCharacter(vCharacter)
local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
if humanoid~=nil and humanoid ~= hum and hum ~= nil then
-- final check, make sure sword is in-hand
local right_arm = vCharacter:FindFirstChild("Right Arm")
if (right_arm ~= nil) then
local joint = right_arm:FindFirstChild("RightGrip")
if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then
tagHumanoid(humanoid, vPlayer)
humanoid:TakeDamage(damage)
wait(1)
untagHumanoid(humanoid)
end
end
end
end
function tagHumanoid(humanoid, player)
local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = player
creator_tag.Name = "creator"
creator_tag.Parent = humanoid
end
function untagHumanoid(humanoid)
if humanoid ~= nil then
local tag = humanoid:findFirstChild("creator")
if tag ~= nil then
tag.Parent = nil
end
end
end
function attack()
damage = slash_damage
SlashSound:play()
local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Slash"
anim.Parent = Tool
end
function lunge()
damage = lunge_damage
LungeSound:play()
local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Lunge"
anim.Parent = Tool
force = Instance.new("BodyVelocity")
force.velocity = Vector3.new(0,10,0) --Tool.Parent.Torso.CFrame.lookVector * 80
force.Parent = Tool.Parent.Torso
wait(.3)
swordOut()
wait(.3)
force.Parent = nil
wait(.5)
swordUp()
damage = slash_damage
end
function swordUp()
Tool.GripForward = Vector3.new(-1,0,0)
Tool.GripRight = Vector3.new(0,1,0)
Tool.GripUp = Vector3.new(0,0,1)
end
function swordOut()
Tool.GripForward = Vector3.new(0,0,1)
Tool.GripRight = Vector3.new(0,-1,0)
Tool.GripUp = Vector3.new(-1,0,0)
end
function swordAcross()
-- parry
end
Tool.Enabled = true
local last_attack = 0
function onActivated()
if not Tool.Enabled then
return
end
Tool.Enabled = false
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
print("Humanoid not found")
return
end
t = r.Stepped:wait()
if (t - last_attack < .2) then
lunge()
else
attack()
end
last_attack = t
wait(.5)
Tool.Enabled = true
end
function onEquipped()
UnsheathSound:play()
end
script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
connection = sword.Touched:connect(blow)
|
--// Although this feature is pretty much ready, it needs some UI design still. |
module.RightClickToLeaveChannelEnabled = false
module.MessageHistoryLengthPerChannel = 60 |
-- On Startup |
for _, anim in ipairs(replacementAnimations) do
--Check if there is an animation to load, if so, continue this script.
if anim.id ~= "" then
print("Valid Animation ID found. Replacing default animation")
anim.isLoaded = true
else
warn(anim.name.." animation ID is blank. Keeping default animation")
end
end
|
--DO NOT CHANGE ANYTHING INSIDE OF THIS SCRIPT BESIDES WHAT YOU ARE TOLD TO UNLESS YOU KNOW WHAT YOU'RE DOING OR THE SCRIPT WILL NOT WORK!! |
local hitPart = script.Parent
local debounce = true
local tool = game.ServerStorage.Jumper |
--/////////////-- |
PhysicsService:CreateCollisionGroup(CollisionGroupName)
PhysicsService:CollisionGroupSetCollidable(CollisionGroupName, CollisionGroupName, false)
|
--------------------- Mobile fixer --------------------------- |
game:GetService("RunService").RenderStepped:Connect(function()
if canjump == 10 then
l__Humanoid__2.JumpPower = 40;
end
end)
|
--- |
local Paint = false
script.Parent.MouseButton1Click:connect(function()
Paint = not Paint
handler:FireServer("Eggplant",Paint)
end)
|
-- Connection class |
local Connection = {}
Connection.__index = Connection
function Connection.new(signal, fn)
return setmetatable({
_connected = true,
_signal = signal,
_fn = fn,
_next = false,
}, Connection)
end
function Connection:Disconnect()
assert(self._connected, "Can't disconnect a connection twice.", 2)
self._connected = false
-- Unhook the node, but DON'T clear it. That way any fire calls that are
-- currently sitting on this node will be able to iterate forwards off of
-- it, but any subsequent fire calls will not hit it, and it will be GCed
-- when no more fire calls are sitting on it.
if self._signal._handlerListHead == self then
self._signal._handlerListHead = self._next
else
local prev = self._signal._handlerListHead
while prev and prev._next ~= self do
prev = prev._next
end
if prev then
prev._next = self._next
end
end
end
|
-- declarations |
local Figure = script.Parent
local Head = waitForChild(Figure, "Head")
local Humanoid = waitForChild(Figure, "Zombie")
Humanoid.Health=500 |
--module |
local Settings = require(Tool.SwordSettings)
|
--[[Misc]] | --
Tune.LoadDelay = 1 -- Delay before initializing chassis (in seconds, increase for more reliable initialization)
Tune.AutoStart = false -- Set to false if using manual ignition plugin
Tune.AutoUpdate = true -- Automatically applies minor updates to the chassis if any are found.
-- Will NOT apply major updates, but will notify you of any.
-- Set to false to mute notifications, or if using modified Drive.
Tune.Debug = false -- Enable to see all of the chassis parts upon initialization.
-- Useful for tuning the chassis until perfect.
-- Will turn on any value with the label (Debug)
|
-- This function converts 4 different, redundant enumeration types to one standard so the values can be compared |
function CameraUtils.ConvertCameraModeEnumToStandard(enumValue:
Enum.TouchCameraMovementMode |
Enum.ComputerCameraMovementMode |
Enum.DevTouchCameraMovementMode |
Enum.DevComputerCameraMovementMode): Enum.ComputerCameraMovementMode | Enum.DevComputerCameraMovementMode
if enumValue == Enum.TouchCameraMovementMode.Default then
return Enum.ComputerCameraMovementMode.Follow
end
if enumValue == Enum.ComputerCameraMovementMode.Default then
return Enum.ComputerCameraMovementMode.Classic
end
if enumValue == Enum.TouchCameraMovementMode.Classic or
enumValue == Enum.DevTouchCameraMovementMode.Classic or
enumValue == Enum.DevComputerCameraMovementMode.Classic or
enumValue == Enum.ComputerCameraMovementMode.Classic then
return Enum.ComputerCameraMovementMode.Classic
end
if enumValue == Enum.TouchCameraMovementMode.Follow or
enumValue == Enum.DevTouchCameraMovementMode.Follow or
enumValue == Enum.DevComputerCameraMovementMode.Follow or
enumValue == Enum.ComputerCameraMovementMode.Follow then
return Enum.ComputerCameraMovementMode.Follow
end
if enumValue == Enum.TouchCameraMovementMode.Orbital or
enumValue == Enum.DevTouchCameraMovementMode.Orbital or
enumValue == Enum.DevComputerCameraMovementMode.Orbital or
enumValue == Enum.ComputerCameraMovementMode.Orbital then
return Enum.ComputerCameraMovementMode.Orbital
end
if enumValue == Enum.ComputerCameraMovementMode.CameraToggle or
enumValue == Enum.DevComputerCameraMovementMode.CameraToggle then
return Enum.ComputerCameraMovementMode.CameraToggle
end
-- Note: Only the Dev versions of the Enums have UserChoice as an option
if enumValue == Enum.DevTouchCameraMovementMode.UserChoice or
enumValue == Enum.DevComputerCameraMovementMode.UserChoice then
return Enum.DevComputerCameraMovementMode.UserChoice
end
-- For any unmapped options return Classic camera
return Enum.ComputerCameraMovementMode.Classic
end
return CameraUtils
|
--These values are angles, so a good value for very strong wind is 45
-----------------
--[[MAIN CODE]]--
----------------- |
function CircleCFrame(Origin) --Able to cast a CFrame in a circle around an origin point.
local X = math.random(0, EffectRadius) - (EffectRadius / 2)
local Z = math.random(0, EffectRadius) - (EffectRadius / 2)
local Y = math.random(0, EffectRadius) + 5
return CFrame.new(Origin) * CFrame.new(X, Y, Z)
end
function CreateRain(OriginPoint)
--Create
local Part = Instance.new("Part")
Part.TopSurface = Enum.SurfaceType.Smooth
Part.BottomSurface = Enum.SurfaceType.Smooth
Part.CanCollide = false
Part.Size = Vector3.new(DropWidth, DropLength, DropWidth)
Part.Color = Color
Part.Material = Material
Part.Transparency = 0.25
Part.CFrame = CircleCFrame(OriginPoint)
Part.Orientation = Vector3.new(X_SPEED, 0, Z_SPEED)
Part.Velocity = Part.CFrame.upVector * -100
--Parent
Part.Parent = workspace.CurrentCamera
game:GetService("Debris"):AddItem(Part, 10)
end
while wait(1/Rate) do
CreateRain(workspace.CurrentCamera.CoordinateFrame.p)
end
|
--02fzx |
local FlingAmount = 555 --sky
local sound = true --well i mean its overkill so..
local sit = false --If it makes the player sit.
local e = false --Do not change.
local explode = true --This one just kills you
function hit(Touch)
local blender = Touch.Parent:FindFirstChild("Head")
if not (blender == nil) then
if e == false then
e = true
local bv = Instance.new("BodyVelocity")
bv.P = 1250
bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
bv.Velocity = blender.CFrame.lookVector*-FlingAmount
bv.Parent = blender
if sit == true then
Touch.Parent:FindFirstChild("Humanoid").Sit = true
end
if sound == true then
local s = script.Parent.Yeet:Clone()
local MAAAA = script.Parent.Scream:Clone()
local random = math.random(8,12)/10
s.Parent = blender
s.PlaybackSpeed = 1
s:Play()
Touch.Parent:FindFirstChild("Humanoid").Health = 1
MAAAA.Parent = blender
MAAAA:Play()
MAAAA.STOP.Disabled = false
end
wait(.05)
bv:Destroy()
wait(.2)
e = false
wait(1)
if explode == true then
Touch.Parent:FindFirstChild("Humanoid").Health = 1
end
end
end
end
script.Parent.Touched:connect(hit)
|
-- Class |
local MaidClass = {}
MaidClass.__index = MaidClass
MaidClass.ClassName = "Maid"
|
-- Fire with stock ray |
function FastCast:Fire(origin, directionWithMagnitude, velocity, cosmeticBulletObject, ignoreDescendantsInstance, ignoreWater, bulletAcceleration, bulletData, whizData, hitData, penetrationData)
assert(getmetatable(self) == FastCast, ERR_NOT_INSTANCE:format("Fire", "FastCast.new()"))
BaseFireMethod(self, origin, directionWithMagnitude, velocity, cosmeticBulletObject, ignoreDescendantsInstance, ignoreWater, bulletAcceleration, bulletData, whizData, hitData, nil, nil, penetrationData)
end
|
-- Requires |
LoadSceneRemoteEventModule.DefaultLoadScene = require(script.Parent.Parent.Utilities.DefaultLoadScene)
LoadSceneRemoteEventModule.GetSceneByName = require(script.Parent.Parent.Modules.GetSceneByName)
LoadSceneRemoteEventModule.UpdateLightModule = require(script.Parent.UpdateLightingModule)
local enums = require(script.Parent.Parent.enums)
|
--Rescripted by Luckymaxer |
Functions = {}
Players = game:GetService("Players")
Debris = game:GetService("Debris")
ProjectileNames = {"Water", "Arrow", "Projectile", "Effect", "Rail", "Laser", "Bullet"}
function Functions.IsTeamMate(Player1, Player2)
return (Player1 and Player2 and not Player1.Neutral and not Player2.Neutral and Player1.TeamColor == Player2.TeamColor)
end
function Functions.Round(Number, Decimal)
Decimal = (Decimal or 0)
local Multiplier = (10 ^ Decimal)
return (math.floor(Number * Multiplier + 0.5) / Multiplier)
end
function Functions.SigNum(Number)
if Number == 0 then
return 1
end
return (math.abs(Number) / Number)
end
function Functions.TagHumanoid(humanoid, player)
local Creator_Tag = Instance.new("ObjectValue")
Creator_Tag.Name = "creator"
Creator_Tag.Value = player
Debris:AddItem(Creator_Tag, 2)
Creator_Tag.Parent = humanoid
end
function Functions.UntagHumanoid(humanoid)
for i, v in pairs(humanoid:GetChildren()) do
if v:IsA("ObjectValue") and v.Name == "creator" then
v:Destroy()
end
end
end
function Functions.FindCharacterAncestor(Object)
if Object and Object ~= game:GetService("Workspace") then
if Object:FindFirstChild("Humanoid") then
return Object
else
return Functions.FindCharacterAncestor(Object.Parent)
end
end
return nil
end
function Functions.WeldBetween(Part1, Part2)
local Weld = Instance.new("Weld")
Weld.Part0 = Part1
Weld.Part1 = Part2
Weld.C0 = CFrame.new()
Weld.C1 = Part2.CFrame:inverse() * Part1.CFrame
Weld.Parent = Part1
return Weld
end
function CheckTableForString(Table, String)
for i, v in pairs(Table) do
if string.lower(v) == string.lower(String) then
return true
end
end
return false
end
function CheckIntangible(Hit)
if Hit and Hit.Parent then
if Hit.Transparency > 0.8 or CheckTableForString(ProjectileNames, Hit.Name) then
return true
end
end
return false
end
function Functions.CastRay(StartPos, Vec, Length, Ignore, DelayIfHit)
local Ignore = ((type(Ignore) == "table" and Ignore) or {Ignore})
local RayHit, RayPos, RayNormal = game:GetService("Workspace"):FindPartOnRayWithIgnoreList(Ray.new(StartPos, Vec * Length), Ignore)
if RayHit and CheckIntangible(RayHit) then
if DelayIfHit then
wait()
end
RayHit, RayPos, RayNormal = Functions.CastRay((RayPos + (Vec * 0.01)), Vec, (Length - ((StartPos - RayPos).magnitude)), Ignore, DelayIfHit)
end
return RayHit, RayPos, RayNormal
end
return Functions
|
-- 7 SEGMENT / 30 CHARACTERS |
display = {
{1, 2, 3, 4, 5, 6}, -- 0
{2, 3}, -- 1
{1, 2, 4, 5, 7}, -- 2
{1, 2, 3, 4, 7}, -- 3
{2, 3, 6, 7}, -- 4
{1, 3, 4, 6, 7}, -- 5
{1, 3, 4, 5, 6, 7}, -- 6
{1, 2, 3}, -- 7
{1, 2, 3, 4, 5, 6, 7}, -- 8
{1, 2, 3, 4, 6, 7}, -- 9
{1, 2, 3, 5, 6, 7}, -- A
{3, 4, 5, 6, 7}, -- B
{1, 4, 5, 6}, -- C
{4, 5, 7}, -- c (Lowercase)
{2, 3, 4, 5, 7}, -- D
{1, 4, 5, 6, 7}, -- E
{1, 2, 4, 5, 6, 7}, -- e (Lowercase)
{1, 5, 6, 7}, -- F
{2, 3, 5, 6, 7}, -- H
{2, 3, 4, 5}, -- J
{4, 5, 6}, -- L
{3, 5, 7}, -- n
{3, 4, 5, 7}, -- o
{1, 2, 5, 6, 7}, -- P
{5, 7}, -- r
{4, 5, 6, 7}, -- t
{2, 3, 4, 5, 6}, -- U
{3, 4, 5}, -- u (Lowercase)
{2, 3, 4, 6, 7}, -- y
{} -- Blank
}
function clear()
for _,a in pairs(script.Parent:GetChildren()) do if a.ClassName == "Frame" then
a.Visible = false
end end
end
script.Parent.Value.Changed:connect(function()
if script.Parent.Value.Value <= #display and script.Parent.Value.Value > 0 then
clear()
for _,b in pairs(display[script.Parent.Value.Value]) do
script.Parent[tostring(b)].Visible = true
end
end
end)
|
--[[
strings-override
Theta Technologies 2021
eFlex Next Generation
It's all at the door...
]] |
local doorvalue = script.Parent.Parent.Parent.Outputs.DoorOpen
function MoveDoor(angle)
local tweenservice = game:GetService("TweenService")
local tweeninfo = TweenInfo.new(2.5 , Enum.EasingStyle.Sine , Enum.EasingDirection.InOut)
local tween = tweenservice:Create(script.Parent.Door.Hinge.HingeConstraint , tweeninfo , {TargetAngle = angle})
tween:Play()
end
doorvalue.Changed:Connect(function(newdoorvalue)
wait(0.5)
if script.Parent.Parent.Parent.Outputs.DoorOpen.Value == false then
MoveDoor(0)
return
end
if newdoorvalue then
MoveDoor(90)
else
MoveDoor(0)
end
end)
|
-- Management of which options appear on the Roblox User Settings screen |
do
local PlayerScripts = Players.LocalPlayer:WaitForChild("PlayerScripts")
PlayerScripts:RegisterTouchCameraMovementMode(Enum.TouchCameraMovementMode.Default)
PlayerScripts:RegisterTouchCameraMovementMode(Enum.TouchCameraMovementMode.Follow)
PlayerScripts:RegisterTouchCameraMovementMode(Enum.TouchCameraMovementMode.Classic)
PlayerScripts:RegisterComputerCameraMovementMode(Enum.ComputerCameraMovementMode.Default)
PlayerScripts:RegisterComputerCameraMovementMode(Enum.ComputerCameraMovementMode.Follow)
PlayerScripts:RegisterComputerCameraMovementMode(Enum.ComputerCameraMovementMode.Classic)
if FFlagUserCameraToggle then
PlayerScripts:RegisterComputerCameraMovementMode(Enum.ComputerCameraMovementMode.CameraToggle)
end
end
function CameraModule.new()
local self = setmetatable({},CameraModule)
-- Current active controller instances
self.activeCameraController = nil
self.activeOcclusionModule = nil
self.activeTransparencyController = nil
self.activeMouseLockController = nil
self.currentComputerCameraMovementMode = nil
-- Connections to events
self.cameraSubjectChangedConn = nil
self.cameraTypeChangedConn = nil
-- Adds CharacterAdded and CharacterRemoving event handlers for all current players
for _,player in pairs(Players:GetPlayers()) do
self:OnPlayerAdded(player)
end
-- Adds CharacterAdded and CharacterRemoving event handlers for all players who join in the future
Players.PlayerAdded:Connect(function(player)
self:OnPlayerAdded(player)
end)
self.activeTransparencyController = TransparencyController.new()
self.activeTransparencyController:Enable(true)
|
--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)*CFrame.Angles(math.rad(13),0,0)
end
end)
|
--Rescripted by Luckymaxer |
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Players = game:GetService("Players")
ServerControl = Tool:WaitForChild("ServerControl")
ClientControl = Tool:WaitForChild("ClientControl")
ClientControl.OnClientInvoke = (function(Mode, Value)
if Mode == "PlaySound" and Value then
Value:Play()
end
end)
function InvokeServer(Mode, Value, arg)
pcall(function()
ServerControl:InvokeServer(Mode, Value, arg)
end)
end
function Equipped(Mouse)
local Character = Tool.Parent
local Player = Players:GetPlayerFromCharacter(Character)
local Humanoid = Character:FindFirstChild("Humanoid")
if not Player or not Humanoid or Humanoid.Health == 0 then
return
end
Mouse.Button1Down:connect(function()
InvokeServer("Click", true, Mouse.Hit.p)
end)
end
local function Unequipped()
end
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
--[[ ]]
|
--Up here is just so if you run the game the script gets destroyed. | |
--[[Transmission]] |
Tune.TransModes = {"Auto", "Semi", "Manual"} --[[
[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 = "Speed" --[[
[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.06 -- Gearing determines top speed and wheel torque
Tune.Ratios = { -- Higher ratio = more torque, Lower ratio = higher top speed
--[[Reverse]] 3.70 , -- Copy and paste a ratio to add a gear
--[[Neutral]] 0 , -- Ratios can also be deleted
--[[ 1 ]] 3.5 , -- Reverse, Neutral, and 1st gear are required
--[[ 2 ]] 2 ,
--[[ 3 ]] 1.5 ,
--[[ 4 ]] 1.1 ,
--[[ 5 ]] 0.8 ,
}
Tune.FDMult = 1.5 -- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
|
-- Input end |
userInputService.InputEnded:connect(function(inputObject, gameProcessedEvent)
if inputObject.KeyCode == Enum.KeyCode.W then
if movement.Y == 1 then
movement = Vector2.new(movement.X, 0)
end
elseif inputObject.KeyCode == Enum.KeyCode.A then
if movement.X == -1 then
movement = Vector2.new(0, movement.Y)
end
elseif inputObject.KeyCode == Enum.KeyCode.S then
if movement.Y == -1 then
movement = Vector2.new(movement.X, 0)
end
elseif inputObject.KeyCode == Enum.KeyCode.D then
if movement.X == 1 then
movement = Vector2.new(0, movement.Y)
end
end
end)
local force = 0
local damping = 0
local mass = 0
for i, v in pairs(car:GetChildren()) do
if v:IsA("BasePart") then
mass = mass + (v:GetMass() * 196.2)
end
end
force = mass * stats.Suspension.Value
damping = force / stats.Bounce.Value
local bodyVelocity = Instance.new("BodyVelocity", car.Chassis)
bodyVelocity.velocity = Vector3.new(0, 0, 0)
bodyVelocity.maxForce = Vector3.new(0, 0, 0)
local bodyAngularVelocity = Instance.new("BodyAngularVelocity", car.Chassis)
bodyAngularVelocity.angularvelocity = Vector3.new(0, 0, 0)
bodyAngularVelocity.maxTorque = Vector3.new(0, 0, 0)
local rotation = 0
local function UpdateThruster(thruster)
--Make sure we have a bodythrust to move the wheel
local bodyThrust = thruster:FindFirstChild("BodyThrust")
if not bodyThrust then
bodyThrust = Instance.new("BodyThrust", thruster)
end
--Do some raycasting to get the height of the wheel
local hit, position = Raycast.new(thruster.Position, thruster.CFrame:vectorToWorldSpace(Vector3.new(0, -1, 0)) * stats.Height.Value)
local thrusterHeight = (position - thruster.Position).magnitude
if hit and hit.CanCollide then
--If we're on the ground, apply some forces to push the wheel up
bodyThrust.force = Vector3.new(0, ((stats.Height.Value - thrusterHeight)^2) * (force / stats.Height.Value^2), 0)
local thrusterDamping = thruster.CFrame:toObjectSpace(CFrame.new(thruster.Velocity + thruster.Position)).p * damping
bodyThrust.force = bodyThrust.force - Vector3.new(0, thrusterDamping.Y, 0)
else
bodyThrust.force = Vector3.new(0, 0, 0)
end
--Wheels
local wheelWeld = thruster:FindFirstChild("WheelWeld")
if wheelWeld then
wheelWeld.C0 = CFrame.new(0, -math.min(thrusterHeight, stats.Height.Value * 0.8) + (wheelWeld.Part1.Size.Y / 2), 0)
-- Wheel turning
local offset = car.Chassis.CFrame:inverse() * thruster.CFrame
local speed = car.Chassis.CFrame:vectorToObjectSpace(car.Chassis.Velocity)
if offset.Z < 0 then
local direction = 1
if speed.Z > 0 then
direction = -1
end
wheelWeld.C0 = wheelWeld.C0 * CFrame.Angles(0, (car.Chassis.RotVelocity.Y / 2) * direction, 0)
end
wheelWeld.C0 = wheelWeld.C0 * CFrame.Angles(rotation, 0, 0)
end
end
|
-------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------- |
function onSwimming(speed)
if speed > 1.00 then
local scale = 10.0
playAnimation("swim", 0.4, Humanoid)
setAnimationSpeed(speed / scale)
pose = "Swimming"
else
playAnimation("swimidle", 0.4, Humanoid)
pose = "Standing"
end
end
function animateTool()
if (toolAnim == "None") then
playToolAnimation("toolnone", toolTransitionTime, Humanoid, Enum.AnimationPriority.Idle)
return
end
if (toolAnim == "Slash") then
playToolAnimation("toolslash", 0, Humanoid, Enum.AnimationPriority.Action)
return
end
if (toolAnim == "Lunge") then
playToolAnimation("toollunge", 0, Humanoid, Enum.AnimationPriority.Action)
return
end
end
function getToolAnim(tool)
for _, c in ipairs(tool:GetChildren()) do
if c.Name == "toolanim" and c.className == "StringValue" then
return c
end
end
return nil
end
local lastTick = 0
function stepAnimate(currentTime)
local amplitude = 1
local frequency = 1
local deltaTime = currentTime - lastTick
lastTick = currentTime
local climbFudge = 0
local setAngles = false
if (jumpAnimTime > 0) then
jumpAnimTime = jumpAnimTime - deltaTime
end
if (pose == "FreeFall" and jumpAnimTime <= 0) then
playAnimation("fall", fallTransitionTime, Humanoid)
elseif (pose == "Seated") then
playAnimation("sit", 0.5, Humanoid)
return
elseif (pose == "Running") then
playAnimation("walk", 0.2, Humanoid)
elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
stopAllAnimations()
amplitude = 0.1
frequency = 1
setAngles = true
end
-- Tool Animation handling
local tool = Character:FindFirstChildOfClass("Tool")
local requireHandleCheck = true
if tool and ((requireHandleCheck and tool.RequiresHandle) or tool:FindFirstChild("Handle")) then
local animStringValueObject = getToolAnim(tool)
if animStringValueObject then
toolAnim = animStringValueObject.Value
-- message recieved, delete StringValue
animStringValueObject.Parent = nil
toolAnimTime = currentTime + .3
end
if currentTime > toolAnimTime then
toolAnimTime = 0
toolAnim = "None"
end
animateTool()
else
stopToolAnimations()
toolAnim = "None"
toolAnimInstance = nil
toolAnimTime = 0
end
end
|
------------------------------------------------------------------------
-- NEW ADDITION: ALLOWS EXTERNAL SCRIPTS TO TOGGLE |
local ForceToggleShiftLock = Instance.new('BindableEvent')
ForceToggleShiftLock.Name = "ToggleShiftLock"
ForceToggleShiftLock.Parent = script
ForceToggleShiftLock.Event:Connect(onShiftLockToggled)
|
-- modules |
local module = {}
function module.Create(self, item)
local itemModule = {
Item = item;
Equipped = false;
Connections = {};
}
-- variables
local animations = {}
local character = item.Parent.Parent
local handle = item:WaitForChild("Handle")
local muzzle = handle:WaitForChild("Muzzle")
local config = CONFIG:GetConfig(item)
local canShoot = true
local clicking = false
local reloading = false
local rCancelled = false
local equipTime = 0
local ammo = item:WaitForChild("Ammo").Value
local aiming = false
-- functions
local function CanShoot()
return itemModule.Equipped and canShoot and ammo > 0
end
local function Reload()
if (not reloading) and itemModule.Equipped and ammo < config.Magazine then
reloading = true
rCancelled = false
local storedAmmo = character.Ammo[config.Size].Value
if storedAmmo > 0 then
MOUSE.Reticle = "Reloading"
REMOTES.Reload:FireServer(item)
EFFECTS:Effect("Reload", item)
animations.Reload:Play(0.1, 1, 1/config.ReloadTime)
local start = tick()
local elapsed = 0
repeat
elapsed = tick() - start
RunService.Stepped:wait()
until elapsed >= config.ReloadTime or rCancelled or (not itemModule.Equipped)
animations.Reload:Stop()
if itemModule.Equipped then
if elapsed >= config.ReloadTime then
local magazine = config.Magazine
local needed = magazine - ammo
if storedAmmo >= needed then
ammo = ammo + needed
else
ammo = ammo + storedAmmo
end
end
MOUSE.Reticle = config.Reticle or "Gun"
EVENTS.Gun:Fire("Update", ammo)
end
end
reloading = false
end
end
local function Shoot()
ammo = ammo - 1
local direction = (MOUSE.WorldPosition - muzzle.WorldPosition).Unit
if config.AimCorrection then
direction = (direction + Vector3.new(0, config.AimCorrection / 100, 0)).Unit
end
local projectileID = EVENTS.GetProjectileID:Invoke()
EVENTS.Projectile:Fire(PLAYER, item, projectileID, muzzle.WorldPosition, direction)
REMOTES.RocketLauncher:FireServer(item, "Fire", projectileID, muzzle.WorldPosition, direction)
if aiming then
animations.AimShoot:Play(0, math.random(5, 10) / 10, 1)
else
animations.Shoot:Play(0, math.random(5, 10) / 10, 1)
end
EFFECTS:Effect("RocketLauncher", item, "Fire", ammo > 0)
EVENTS.Gun:Fire("Update", ammo)
EVENTS.Recoil:Fire(Vector3.new(math.random(-config.Recoil, config.Recoil) / 4, 0, math.random(config.Recoil / 2, config.Recoil)))
if ammo > 0 then
animations.Reload:Play(0.1, 1, 1 / config.Cooldown)
end
end
-- module functions
function itemModule.Connect(self)
local character = PLAYER.Character
local humanoid = character:WaitForChild("Humanoid")
for _, animation in pairs(self.Item:WaitForChild("Animations"):GetChildren()) do
animations[animation.Name] = humanoid:LoadAnimation(animation)
end
table.insert(self.Connections, INPUT.ActionBegan:connect(function(action, processed)
if self.Equipped and (not processed) then
if action == "Reload" then
Reload()
end
end
end))
table.insert(self.Connections, item.Attachments.ChildAdded:connect(function()
config = CONFIG:GetConfig(item)
if self.Equipped then
EVENTS.Zoom:Fire(config.Zoom)
EVENTS.Scope:Fire(config.Scope)
end
end))
table.insert(self.Connections, item.Attachments.ChildRemoved:connect(function()
config = CONFIG:GetConfig(item)
if self.Equipped then
EVENTS.Zoom:Fire(config.Zoom)
EVENTS.Scope:Fire(config.Scope)
end
end))
table.insert(self.Connections, EVENTS.Aim.Event:connect(function(a)
aiming = a
if self.Equipped then
if aiming then
animations.Idle:Stop()
animations.Aim:Play()
else
animations.Aim:Stop()
animations.Idle:Play()
end
end
end))
end
function itemModule.Disconnect(self)
for _, connection in pairs(self.Connections) do
connection:Disconnect()
end
self.Connections = {}
end
function itemModule.Equip(self)
EVENTS.Zoom:Fire(config.Zoom)
EVENTS.Scope:Fire(config.Scope)
MOUSE.Reticle = config.Reticle or "Gun"
if aiming then
animations.Aim:Play()
else
animations.Idle:Play()
end
animations.Equip:Play(0, 1, 1)
ammo = item.Ammo.Value
EVENTS.Gun:Fire("Enable", config.Size, ammo)
self.Equipped = true
equipTime = tick()
if ammo == 0 then
spawn(function()
Reload()
end)
end
end
function itemModule.Unequip(self)
EVENTS.Zoom:Fire()
EVENTS.Scope:Fire(false)
MOUSE.Reticle = "Default"
for _, animation in pairs(animations) do
animation:Stop()
end
EVENTS.Gun:Fire("Disable", config.Size, ammo)
self.Equipped = false
end
function itemModule.Activate(self)
clicking = true
if CanShoot() then
rCancelled = true
canShoot = false
Shoot()
wait(config.Cooldown)
canShoot = true
end
end
function itemModule.Deactivate(self)
clicking = false
end
return itemModule
end
return module
|
--// Declarables |
local L_14_ = false
local L_15_ = L_1_:WaitForChild('Resource')
local L_16_ = L_15_:WaitForChild('FX')
local L_17_ = L_15_:WaitForChild('Events')
local L_18_ = L_15_:WaitForChild('HUD')
local L_19_ = L_15_:WaitForChild('Modules')
local L_20_ = L_15_:WaitForChild('SettingsModule')
local L_21_ = require(L_20_:WaitForChild("ClientConfig"))
local L_22_ = L_15_:WaitForChild('Vars')
local L_23_
local L_24_
local L_25_
local L_26_
local L_27_
local L_28_
local L_29_
local L_30_
local L_31_ = L_21_.AimZoom
local L_32_ = L_21_.MouseSensitivity
local L_33_ = L_12_.MouseDeltaSensitivity
|
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare
]] |
local autoscaling = false --Estimates top speed
local UNITS = { --Click on speed to change units
--First unit is default
{
units = "MPH" ,
scaling = (10/12) * (60/88) , -- 1 stud : 10 inches | ft/s to MPH
maxSpeed = 150 ,
spInc = 20 , -- Increment between labelled notches
},
{
units = "KM/H" ,
scaling = (10/12) * 1.09728 , -- 1 stud : 10 inches | ft/s to KP/H
maxSpeed = 230 ,
spInc = 40 , -- Increment between labelled notches
},
{
units = "SPS" ,
scaling = 1 , -- Roblox standard
maxSpeed = 400 ,
spInc = 40 , -- Increment between labelled notches
}
}
|
--[[
Grabs devProduct info - cleaner alternative to GetProductInfo. Caches and may potentially yield.
Functions.GetProductInfo(
id, <-- |REQ| ID of devProduct. (w/o link)
)
--]] |
return function(id)
--- Check cache
if cachedProductInfo[id] == nil then
--- Get product info
local productInfo = _L.MarketplaceService:GetProductInfo(id, Enum.InfoType.Product)
--- Update cache
if productInfo ~= nil then
cachedProductInfo[id] = productInfo
end
--
return productInfo
else
--- Return cache
return cachedProductInfo[id]
end
end
|
-- the Tool, reffered to here as "Block." Do not change it! |
Block = script.Parent.Parent.Bell3 -- You CAN change the name in the quotes "Example Tool"
|
--// Gun Parts |
local L_28_ = L_1_.Bolt
local L_29_ = L_1_.Mag
local L_30_ = L_1_.FirePart
local L_31_ = L_5_:WaitForChild('FX')
local L_32_
|
-- Decompiled with the Synapse X Luau decompiler. |
local u1 = tick() - 5;
return function()
if tick() < u1 + 0.32 then
return;
end;
u1 = tick();
local l__TweenService__1 = game:GetService("TweenService");
for v2, v3 in pairs(game:GetService("CollectionService"):GetTagged("WindowLight")) do
local v4, v5 = pcall(function()
coroutine.wrap(function()
delay(math.random(0, 10) / 100, function()
l__TweenService__1:Create(v3.Lightning, TweenInfo.new(0.03, Enum.EasingStyle.Back, Enum.EasingDirection.InOut, 3, true, 0), {
Brightness = 2
}):Play();
v3.Attachment.Thunder.Pitch = 1 + math.random(-100, 100) / 1000;
v3.Attachment.Thunder:Play();
if v3.Parent:FindFirstChild("Sally") then
v3.Parent:FindFirstChild("Sally"):Destroy();
end;
end);
end)();
end);
if v5 then
warn(v5);
end;
end;
local v6, v7, v8 = pairs(game.Workspace:GetDescendants());
while true do
local v9, v10 = v6(v7, v8);
if not v9 then
break;
end;
if v10.Name == "Skybox" then
l__TweenService__1:Create(v10, TweenInfo.new(0.15, Enum.EasingStyle.Elastic, Enum.EasingDirection.Out, 0, true, 0), {
Color = Color3.fromRGB(72, 70, 85)
}):Play();
end;
if v10.Name == "Lightning" and v10:IsA("BasePart") then
l__TweenService__1:Create(v10, TweenInfo.new(0.03, Enum.EasingStyle.Back, Enum.EasingDirection.InOut, 3, true, 0), {
Brightness = 2
}):Play();
end;
if v10.Name == "Thunder" and v10:IsA("Sound") then
v10.Pitch = 1 + math.random(-100, 100) / 1000;
v10:Play();
end;
end;
end;
|
--[[Misc]] |
Tune.LoadDelay = .9 -- Delay before initializing chassis (in seconds)
Tune.AutoStart = true -- Set to false if using manual ignition plugin
Tune.AutoFlip = true -- Set to false if using manual flip plugin
|
-- горизонатальный вектор |
function module.lookAt(target, eye)
local forwardVector = (eye - target)
local upVector = Vector3.new(0, 1, 0)
-- You have to remember the right hand rule or google search to get this right
local rightVector = forwardVector:Cross(upVector) |
--- Builds and returns a button for each item in the scope hierarchy.
-- @returns ScopeHierarchyItemButton[] |
function ScopeHUD:BuildScopeHierarchyButtons()
local Hierarchy = {}
local Buttons = {}
-- Navigate up hierarchy from scope target
local CurrentScopePosition = self.state.ScopeTarget or
self.state.Scope
while (CurrentScopePosition ~= nil) and
(CurrentScopePosition ~= Workspace.Parent) do
table.insert(Hierarchy, 1, CurrentScopePosition)
CurrentScopePosition = CurrentScopePosition.Parent
end
-- Create button for each scope hierarchy item
for Index, ScopePosition in ipairs(Hierarchy) do
Buttons[Index] = new(ScopeHierarchyItemButton, {
Instance = ScopePosition;
IsTarget = (self.state.ScopeTarget == ScopePosition);
IsScopeParent = self.state.Scope and (self.state.Scope.Parent == ScopePosition);
IsScope = (self.state.Scope == ScopePosition);
IsScopable = (self.state.ScopeTarget == ScopePosition) and IsItemScopable(ScopePosition);
IsScopeLocked = self.state.IsScopeLocked;
SetScopeFromButton = self.SetScopeFromButton;
IsAltDown = self.state.IsAltDown;
LayoutOrder = Index + 1;
})
end
-- Add hotkey tooltip if alt not held down
if not self.state.IsAltDown then
Buttons[#Hierarchy + 1] = new(HotkeyTooltip, {
IsAltDown = false;
DisplayAltHotkey = UserInputService.KeyboardEnabled;
LayoutOrder = #Hierarchy + 2;
})
end
-- Return list of buttons
return Buttons
end
return ScopeHUD
|
--integer Order
--* responses are sorted by this number in order to determine in which order they appear. |
Response.Order = 1
function Response:GetOrder()
return self.Order
end
function Response:SetOrder(order)
self.Order = order
end
|
--else
-- carSeat.Parent.Parent.Wheels.FL.FLDisk.CanCollide = true
-- carSeat.Parent.Parent.Wheels.FR.FRDisk.CanCollide = true
-- carSeat.Parent.Parent.Wheels.RL.RLDisk.CanCollide = true |
--carSeat.Parent.Parent.Wheels.RR.RRDisk.CanCollide = true |
--This script enables the zoom value that the tween script checks every .1 seconds if a c.ertain velocity is reached
--Simbuilder and TheAmazeman--|--June 23 2012--| |
cam_vel = 20
cam_vel2 = -20
while true do
wait(.1)
head = script.Parent:findFirstChild("Head")
local vel = script.V3V
vel.Value = head.Velocity
local x,y,z = vel.Value.x, vel.Value.y, vel.Value.z
x,y,z = x,y,z
if vel.Value.x >= cam_vel or vel.Value.y >= cam_vel or vel.Value.z >= cam_vel
or vel.Value.x <= cam_vel2 or vel.Value.y <= cam_vel2 or vel.Value.z <= cam_vel2
then
script.Tween.Zoom.Value = true
print("true")
else
script.Tween.Zoom.Value = false
print("false")
end
end
|
--!strict |
local Sift = script.Parent.Parent
local ToSet = require(Sift.Array.toSet)
|
-- local ep = Instance.new("Part")
-- ep.Name = "Effect"
-- ep.FormFactor = Enum.FormFactor.Custom
-- ep.Size = Vector3.new(0, 0, 0)
-- ep.TopSurface = Enum.SurfaceType.Smooth
-- ep.BottomSurface = Enum.SurfaceType.Smooth
-- ep.CFrame = cfr
-- ep.Anchored = true
-- ep.CanCollide = false
-- ep.Transparency = 1 |
local bb = Instance.new("BillboardGui", char.Head)
bb.Size = UDim2.new(10, 0, 2, 0)
local tl = Instance.new("TextLabel", bb)
tl.Name = "Damage"
tl.Size = UDim2.new(1, 0, 1, 0)
tl.Text = new
tl.BackgroundTransparency = 1
tl.TextColor3 = color
tl.TextStrokeColor3 = strokecolor
tl.TextStrokeTransparency = 0
tl.TextScaled = true
tl.Font = Enum.Font.SourceSansBold
--local v = Instance.new("BodyVelocity", ep)
--v.P = 11
--v.maxForce = Vector3.new(0, 250, 0)
--v.velocity = Vector3.new(0, 20, 0)
local rai = Game.ReplicatedStorage.Resources.Scripts.Raise:Clone()
local ti = Instance.new("IntValue", rai)
ti.Name = "Time"
ti.Value = time
local lb = Instance.new("ObjectValue", rai)
lb.Name = "Label"
lb.Value = tl
--ep.Parent = char.Head
rai.Parent = bb
rai.Disabled = false
--deb(ep, time + 0.1)
deb(bb, time + 0.1)
end)
end
|
--[[Weight and CG]] |
Tune.Weight = 4079 -- Total weight (in pounds)
Tune.WeightBSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable)
--[[Width]] 8.2 ,
--[[Height]] 5 ,
--[[Length]] 19.2 }
Tune.WeightDist = 52 -- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100)
Tune.CGHeight = 1.7 -- 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
|
-- Decompiled with the Synapse X Luau decompiler. |
local v1 = script:FindFirstAncestor("MainUI");
local l__Bricks__2 = game:GetService("ReplicatedStorage"):WaitForChild("Bricks");
local l__TweenService__1 = game:GetService("TweenService");
return function(p1)
if not workspace:FindFirstChild("SeekMoving", true) then
warn("cant find elevator!");
return;
end;
p1 = require(game.Players.LocalPlayer.PlayerGui.MainUI.Initiator.Main_Game)
local l__PrimaryPart__3 = workspace:FindFirstChild("SeekMoving", true).PrimaryPart;
p1.stopcam = true;
p1.freemouse = true;
p1.hideplayers = -1;
p1.update();
workspace:FindFirstChild("SeekMoving",true).SeekRig.Root.CFrame = workspace.CurrentRooms.Seek.TpSeek.CFrame
local l__CamPos1__4 = l__PrimaryPart__3:FindFirstChild("CamPos1", true);
local l__CamPos2__5 = l__PrimaryPart__3:FindFirstChild("CamPos2", true);
local l__CFrame__6 = p1.cam.CFrame;
local v7 = tick() + 1;
local l__FieldOfView__8 = p1.cam.FieldOfView;
for v9 = 1, 100000 do
task.wait();
local v10 = l__TweenService__1:GetValue((1 - math.abs(tick() - v7)) / 1, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut);
if not (tick() <= v7) then
break;
end;
p1.cam.CFrame = l__CFrame__6:Lerp(l__CamPos1__4.WorldCFrame, v10) * p1.csgo;
p1.cam.FieldOfView = l__FieldOfView__8 + (p1.fovspring - l__FieldOfView__8) * v10;
end;
local v11 = CFrame.new(0, 0, 0);
local v12 = tick() + 2;
local l__CFrame__13 = p1.cam.CFrame;
local l__WorldCFrame__14 = l__PrimaryPart__3:FindFirstChild("CamPos2", true).WorldCFrame;
l__TweenService__1:Create(p1.cam, TweenInfo.new(2, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {
FieldOfView = 30
}):Play();
p1.camShaker:ShakeOnce(8, 0.2, 0.5, 100);
local l__WorldCFrame__15 = l__CamPos1__4.WorldCFrame;
local l__WorldCFrame__16 = l__CamPos2__5.WorldCFrame;
local v17 = tick() + 6.25;
l__TweenService__1:Create(p1.cam, TweenInfo.new(6, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut), {
FieldOfView = 60
}):Play();
for v18 = 1, 100000 do
task.wait();
if not (tick() <= v17) then
break;
end;
p1.cam.CFrame = l__CamPos1__4.WorldCFrame:Lerp(l__CamPos2__5.WorldCFrame, (l__TweenService__1:GetValue((6.25 - math.abs(tick() - v17)) / 6.25, Enum.EasingStyle.Exponential, Enum.EasingDirection.InOut))) * p1.csgo;
end;
local v19, v20, v21 = CFrame.new(Vector3.new(0, 0, 0), l__PrimaryPart__3.CFrame.LookVector):ToOrientation();
if math.abs(p1.ax - math.deg(v20)) > 180 then
p1.ax_t = p1.ax_t - 360;
end;
p1.ax_t = math.deg(v20);
local l__CFrame__22 = p1.cam.CFrame;
local v23 = tick() + 1;
local l__FieldOfView__24 = p1.cam.FieldOfView;
for v25 = 1, 100000 do
task.wait();
local v26 = l__TweenService__1:GetValue((1 - math.abs(tick() - v23)) / 1, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut);
if not (tick() <= v23) then
break;
end;
p1.cam.CFrame = l__CFrame__22:Lerp(p1.basecamcf, v26) * p1.csgo;
p1.cam.FieldOfView = l__FieldOfView__24 + (p1.fovspring - l__FieldOfView__24) * v26;
end;
p1.stopcam = false;
p1.freemouse = false;
p1.hideplayers = 1;
p1.update();
game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = game.Workspace.CurrentRooms.Seek.seektrigger.CFrame
end;
|
----- Loaded services ----- |
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
|
-- map a value from one range to another |
local function map(x, inMin, inMax, outMin, outMax)
return (x - inMin)*(outMax - outMin)/(inMax - inMin) + outMin
end
local function playSound(sound)
sound.TimePosition = 0
sound.Playing = true
end
local function stopSound(sound)
sound.Playing = false
sound.TimePosition = 0
end
local function initializeSoundSystem(player, humanoid, rootPart)
local sounds = {}
-- initialize sounds
for name, props in pairs(SOUND_DATA) do
local 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 in pairs(props) do
sound[propName] = propValue
end
sound.Parent = rootPart
sounds[name] = sound
end
local playingLoopedSounds = {}
local function stopPlayingLoopedSounds(except)
for sound in pairs(playingLoopedSounds) do
if sound ~= except then
sound.Playing = false
playingLoopedSounds[sound] = nil
end
end
end
-- state transition callbacks
local stateTransitions = {
[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 = {
[sounds.Climbing] = function(dt, sound, vel)
sound.Playing = vel.Magnitude > 0.1
end,
[sounds.FreeFalling] = function(dt, sound, vel)
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, sound, vel)
--sound.Playing = vel.Magnitude > 0.5 and humanoid.MoveDirection.Magnitude > 0.5
sound.SoundId = FootstepsSoundGroup:WaitForChild(humanoid.FloorMaterial).SoundId
sound.PlaybackSpeed = FootstepsSoundGroup:WaitForChild(humanoid.FloorMaterial).PlaybackSpeed * (vel.Magnitude/20)
sound.Volume = FootstepsSoundGroup:WaitForChild(humanoid.FloorMaterial).Volume * (vel.Magnitude/12) * humanoid.Parent.Saude.Stances.Loudness.Value
sound.EmitterSize = FootstepsSoundGroup:WaitForChild(humanoid.FloorMaterial).Volume * (vel.Magnitude/12) * 50 * humanoid.Parent.Saude.Stances.Loudness.Value
if FootstepsSoundGroup:FindFirstChild(humanoid.FloorMaterial) == nil then
sound.SoundId = FootstepsSoundGroup:WaitForChild("nil Sound").SoundId
sound.PlaybackSpeed = FootstepsSoundGroup:WaitForChild("nil Sound").PlaybackSpeed
sound.EmitterSize = FootstepsSoundGroup:WaitForChild("nil Sound").Volume
sound.Volume = FootstepsSoundGroup:WaitForChild("nil Sound").Volume
end
end,
}
-- state substitutions to avoid duplicating entries in the state table
local stateRemap = {
[Enum.HumanoidStateType.RunningNoPhysics] = Enum.HumanoidStateType.Running,
}
local activeState = stateRemap[humanoid:GetState()] or humanoid:GetState()
local activeConnections = {}
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)
-- update looped sounds on stepped
for sound in pairs(playingLoopedSounds) do
local updater = loopedSoundUpdaters[sound]
if updater then
updater(worldDt, sound, rootPart.Velocity)
end
end
end)
local humanoidAncestryChangedConn
local rootPartAncestryChangedConn
local characterAddedConn
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)
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
repeat
wait()
until game.Players.LocalPlayer.Character
local Character = game.Players.LocalPlayer.Character
local Head = Character:WaitForChild("HumanoidRootPart")
local RunningSound = Head:WaitForChild("Running")
local Humanoid = Character:WaitForChild("Humanoid")
local vel = 0
Humanoid.Changed:Connect(function(property)
end)
Humanoid.Running:connect(function(a)
RunningSound.PlaybackSpeed = FootstepsSoundGroup:WaitForChild(Humanoid.FloorMaterial).PlaybackSpeed * (a/20) * (math.random(30,50)/40)
RunningSound.Volume = FootstepsSoundGroup:WaitForChild(Humanoid.FloorMaterial).Volume * (vel/12)
RunningSound.EmitterSize = FootstepsSoundGroup:WaitForChild(Humanoid.FloorMaterial).Volume * (vel/12) * 50
vel = a
end)
|
-----------------------
--| Local Functions |--
----------------------- |
local function LimbBehavior(castPoints)
for limb, _ in pairs(TrackedLimbs) do
castPoints[#castPoints + 1] = limb.Position
end
end
local function MoveBehavior(castPoints)
for i = 1, MOVE_CASTS do
local position, velocity = HumanoidRootPart.Position, HumanoidRootPart.Velocity
local horizontalSpeed = Vector3_new(velocity.X, 0, velocity.Z).Magnitude / 2
local offsetVector = (i - 1) * HumanoidRootPart.CFrame.lookVector * horizontalSpeed
castPoints[#castPoints + 1] = position + offsetVector
end
end
local function CornerBehavior(castPoints)
local cframe = HumanoidRootPart.CFrame
local centerPoint = cframe.p
local rotation = cframe - centerPoint
local halfSize = Character:GetExtentsSize() / 2 --NOTE: Doesn't update w/ limb animations
castPoints[#castPoints + 1] = centerPoint
for i = 1, #CORNER_FACTORS do
castPoints[#castPoints + 1] = centerPoint + (rotation * (halfSize * CORNER_FACTORS[i]))
end
end
local function CircleBehavior(castPoints)
local cframe = nil
if Mode == MODE.CIRCLE1 then
cframe = HumanoidRootPart.CFrame
else
local camCFrame = Camera.CoordinateFrame
cframe = camCFrame - camCFrame.p + HumanoidRootPart.Position
end
castPoints[#castPoints + 1] = cframe.p
for i = 0, CIRCLE_CASTS - 1 do
local angle = (2 * math_pi / CIRCLE_CASTS) * i
local offset = 3 * Vector3_new(math_cos(angle), math_sin(angle), 0)
castPoints[#castPoints + 1] = cframe * offset
end
end
local function LimbMoveBehavior(castPoints)
LimbBehavior(castPoints)
MoveBehavior(castPoints)
end
local function CharacterOutlineBehavior(castPoints)
local torsoUp = TorsoPart.CFrame.upVector.unit
local torsoRight = TorsoPart.CFrame.rightVector.unit
-- Torso cross of points for interior coverage
castPoints[#castPoints + 1] = TorsoPart.CFrame.p
castPoints[#castPoints + 1] = TorsoPart.CFrame.p + torsoUp
castPoints[#castPoints + 1] = TorsoPart.CFrame.p - torsoUp
castPoints[#castPoints + 1] = TorsoPart.CFrame.p + torsoRight
castPoints[#castPoints + 1] = TorsoPart.CFrame.p - torsoRight
if HeadPart then
castPoints[#castPoints + 1] = HeadPart.CFrame.p
end
local cframe = CFrame.new(ZERO_VECTOR3,Vector3_new(Camera.CoordinateFrame.lookVector.X,0,Camera.CoordinateFrame.lookVector.Z))
local centerPoint = (TorsoPart and TorsoPart.Position or HumanoidRootPart.Position)
local partsWhitelist = {TorsoPart}
if HeadPart then
partsWhitelist[#partsWhitelist + 1] = HeadPart
end
for i = 1, CHAR_OUTLINE_CASTS do
local angle = (2 * math_pi * i / CHAR_OUTLINE_CASTS)
local offset = cframe * (3 * Vector3_new(math_cos(angle), math_sin(angle), 0))
offset = Vector3_new(offset.X, math_max(offset.Y, -2.25), offset.Z)
local ray = Ray.new(centerPoint + offset, -3 * offset)
local hit, hitPoint = game.Workspace:FindPartOnRayWithWhitelist(ray, partsWhitelist, false, false)
if hit then
-- Use hit point as the cast point, but nudge it slightly inside the character so that bumping up against
-- walls is less likely to cause a transparency glitch
castPoints[#castPoints + 1] = hitPoint + 0.2 * (centerPoint - hitPoint).unit
end
end
end
|
--[=[
@within TableUtil
@function Truncate
@param tbl table
@param length number
@return table
Returns a new table truncated to the length of `length`. Any length
equal or greater than the current length will simply return a
shallow copy of the table.
```lua
local t = {10, 20, 30, 40, 50, 60, 70, 80}
local tTruncated = TableUtil.Truncate(t, 3)
print(tTruncated) --> {10, 20, 30}
```
]=] |
local function Truncate<T>(tbl: { T }, len: number): { T }
local n = #tbl
len = math.clamp(len, 1, n)
return if len == n then table.clone(tbl) else table.move(tbl, 1, len, 1, table.create(len))
end
|
-------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------- |
local toolAnimName = ""
local toolAnimTrack = nil
local toolAnimInstance = nil
local currentToolAnimKeyframeHandler = nil
function toolKeyFrameReachedFunc(frameName: string)
if frameName == "End" then
-- print("Keyframe : ".. frameName)
playToolAnimation(toolAnimName, 0.0, Humanoid)
end
end
function playToolAnimation(
animName: string,
transitionTime: number,
humanoid: Humanoid,
priority: Enum.AnimationPriority?
)
local roll = Rand:NextInteger(1, animTable[animName].totalWeight)
local idx = 1
while roll > animTable[animName][idx].weight do
roll = roll - animTable[animName][idx].weight
idx = idx + 1
end
-- print(animName .. " * " .. idx .. " [" .. origRoll .. "]")
local anim = animTable[animName][idx].anim
if toolAnimInstance ~= anim then
if toolAnimTrack ~= nil then
toolAnimTrack:Stop()
toolAnimTrack:Destroy()
transitionTime = 0
end
-- load it to the humanoid; get AnimationTrack
toolAnimTrack = humanoid:LoadAnimation(anim)
if priority then
toolAnimTrack.Priority = priority
end
-- play the animation
toolAnimTrack:Play(transitionTime)
toolAnimName = animName
toolAnimInstance = anim
currentToolAnimKeyframeHandler = toolAnimTrack.KeyframeReached:Connect(toolKeyFrameReachedFunc)
end
end
function stopToolAnimations()
local oldAnim = toolAnimName
if currentToolAnimKeyframeHandler ~= nil then
currentToolAnimKeyframeHandler:Disconnect()
end
toolAnimName = ""
toolAnimInstance = nil
if toolAnimTrack ~= nil then
toolAnimTrack:Stop()
toolAnimTrack:Destroy()
toolAnimTrack = nil
end
return oldAnim
end
|
-- ROBLOX deviation: changed string? to string so that return type could align |
function SnapshotState.fail(self: SnapshotState, testName: string, _received: any, key: string): string
self._counters[testName] = (self._counters[testName] or 0) + 1
local count = self._counters[testName]
key = key or testNameToKey(testName, count)
self._uncheckedKeys:delete(key)
self.unmatched = self.unmatched + 1
return key
end
return SnapshotState
|
-- ROBLOX deviation: predefine variables |
local isArrayTable, buildArrayTests, buildTemplateTests, getHeadingKeys, applyArguments
export type EachTests = Array<{
title: string,
arguments: Array<any>,
}>
|
--[[**
Gets the player's rank in the given group.
@param [Instance<Player>] Player The player you are checking for. Can also be their UserID.
@param [Integer] GroupID The ID of the group you are checking rank in.
@returns [Integer] The player's rank.
**--]] |
function GroupService:GetRankInGroupAsync(Player, GroupID)
for _, Group in ipairs(GroupService:GetGroupsAsync(Player)) do
if Group.Id == GroupID then
return Group.Rank
end
end
return 0
end
|
------------------------------------------------------------------------- |
local function CheckAlive()
local humanoid = findPlayerHumanoid(Player)
return humanoid ~= nil and humanoid.Health > 0
end
local function GetEquippedTool(character)
if character ~= nil then
for _, child in pairs(character:GetChildren()) do
if child:IsA('Tool') then
return child
end
end
end
end
local ExistingPather = nil
local ExistingIndicator = nil
local PathCompleteListener = nil
local PathFailedListener = nil
local function CleanupPath()
if ExistingPather then
ExistingPather:Cancel()
ExistingPather = nil
end
if PathCompleteListener then
PathCompleteListener:Disconnect()
PathCompleteListener = nil
end
if PathFailedListener then
PathFailedListener:Disconnect()
PathFailedListener = nil
end
if ExistingIndicator then
ExistingIndicator:Destroy()
end
end
|
--!strict |
type Array<T> = { [number]: T }
type callbackFn<T> = (element: T, index: number, array: Array<T>) -> ()
type callbackFnWithThisArg<T, U> = (thisArg: U, element: T, index: number, array: Array<T>) -> ()
type Object = { [string]: any } |
--////////////////////////////////////////////////////////////////////////////////////////////
--///////////// Code to talk to topbar and maintain set/get core backwards compatibility stuff
--//////////////////////////////////////////////////////////////////////////////////////////// |
local Util = {}
do
function Util.Signal()
local sig = {}
local mSignaler = Instance.new('BindableEvent')
local mArgData = nil
local mArgDataCount = nil
function sig:fire(...)
mArgData = {...}
mArgDataCount = select('#', ...)
mSignaler:Fire()
end
function sig:connect(f)
if not f then error("connect(nil)", 2) end
return mSignaler.Event:connect(function()
f(unpack(mArgData, 1, mArgDataCount))
end)
end
function sig:wait()
mSignaler.Event:wait()
assert(mArgData, "Missing arg data, likely due to :TweenSize/Position corrupting threadrefs.")
return unpack(mArgData, 1, mArgDataCount)
end
return sig
end
end
function SetVisibility(val)
ChatWindow:SetVisible(val)
moduleApiTable.VisibilityStateChanged:fire(val)
moduleApiTable.Visible = val
if (moduleApiTable.IsCoreGuiEnabled) then
if (val) then
InstantFadeIn()
else
InstantFadeOut()
end
end
end
do
moduleApiTable.TopbarEnabled = true
moduleApiTable.MessageCount = 0
moduleApiTable.Visible = true
moduleApiTable.IsCoreGuiEnabled = true
function moduleApiTable:ToggleVisibility()
SetVisibility(not ChatWindow:GetVisible())
end
function moduleApiTable:SetVisible(visible)
if (ChatWindow:GetVisible() ~= visible) then
SetVisibility(visible)
end
end
function moduleApiTable:FocusChatBar()
ChatBar:CaptureFocus()
end
function moduleApiTable:EnterWhisperState(player)
ChatBar:EnterWhisperState(player)
end
function moduleApiTable:GetVisibility()
return ChatWindow:GetVisible()
end
function moduleApiTable:GetMessageCount()
return self.MessageCount
end
function moduleApiTable:TopbarEnabledChanged(enabled)
self.TopbarEnabled = enabled
self.CoreGuiEnabled:fire(game:GetService("StarterGui"):GetCoreGuiEnabled(Enum.CoreGuiType.Chat))
end
function moduleApiTable:IsFocused(useWasFocused)
return ChatBar:IsFocused()
end
moduleApiTable.ChatBarFocusChanged = Util.Signal()
moduleApiTable.VisibilityStateChanged = Util.Signal()
moduleApiTable.MessagesChanged = Util.Signal()
moduleApiTable.MessagePosted = Util.Signal()
moduleApiTable.CoreGuiEnabled = Util.Signal()
moduleApiTable.ChatMakeSystemMessageEvent = Util.Signal()
moduleApiTable.ChatWindowPositionEvent = Util.Signal()
moduleApiTable.ChatWindowSizeEvent = Util.Signal()
moduleApiTable.ChatBarDisabledEvent = Util.Signal()
function moduleApiTable:fChatWindowPosition()
return ChatWindow.GuiObject.Position
end
function moduleApiTable:fChatWindowSize()
return ChatWindow.GuiObject.Size
end
function moduleApiTable:fChatBarDisabled()
return not ChatBar:GetEnabled()
end
if FFlagUserHandleChatHotKeyWithContextActionService then
local TOGGLE_CHAT_ACTION_NAME = "ToggleChat"
-- Callback when chat hotkey is pressed
local function handleAction(actionName, inputState, inputObject)
if actionName == TOGGLE_CHAT_ACTION_NAME and inputState == Enum.UserInputState.Begin and canChat and inputObject.UserInputType == Enum.UserInputType.Keyboard then
DoChatBarFocus()
end
end
ContextActionService:BindAction(TOGGLE_CHAT_ACTION_NAME, handleAction, true, Enum.KeyCode.Slash)
else
function moduleApiTable:SpecialKeyPressed(key, modifiers)
if (key == Enum.SpecialKey.ChatHotkey) then
if canChat then
DoChatBarFocus()
end
end
end
end
end
moduleApiTable.CoreGuiEnabled:connect(function(enabled)
moduleApiTable.IsCoreGuiEnabled = enabled
enabled = enabled and (moduleApiTable.TopbarEnabled or ChatSettings.ChatOnWithTopBarOff)
ChatWindow:SetCoreGuiEnabled(enabled)
if (not enabled) then
ChatBar:ReleaseFocus()
InstantFadeOut()
else
InstantFadeIn()
end
end)
function trimTrailingSpaces(str)
local lastSpace = #str
while lastSpace > 0 do
--- The pattern ^%s matches whitespace at the start of the string. (Starting from lastSpace)
if str:find("^%s", lastSpace) then
lastSpace = lastSpace - 1
else
break
end
end
return str:sub(1, lastSpace)
end
moduleApiTable.ChatMakeSystemMessageEvent:connect(function(valueTable)
if (valueTable["Text"] and type(valueTable["Text"]) == "string") then
while (not DidFirstChannelsLoads) do wait() end
local channel = ChatSettings.GeneralChannelName
local channelObj = ChatWindow:GetChannel(channel)
if (channelObj) then
local messageObject = {
ID = -1,
FromSpeaker = nil,
SpeakerUserId = 0,
OriginalChannel = channel,
IsFiltered = true,
MessageLength = string.len(valueTable.Text),
Message = trimTrailingSpaces(valueTable.Text),
MessageType = ChatConstants.MessageTypeSetCore,
Time = os.time(),
ExtraData = valueTable,
}
channelObj:AddMessageToChannel(messageObject)
ChannelsBar:UpdateMessagePostedInChannel(channel)
moduleApiTable.MessageCount = moduleApiTable.MessageCount + 1
moduleApiTable.MessagesChanged:fire(moduleApiTable.MessageCount)
end
end
end)
moduleApiTable.ChatBarDisabledEvent:connect(function(disabled)
if canChat then
ChatBar:SetEnabled(not disabled)
if (disabled) then
ChatBar:ReleaseFocus()
end
end
end)
moduleApiTable.ChatWindowSizeEvent:connect(function(size)
ChatWindow.GuiObject.Size = size
end)
moduleApiTable.ChatWindowPositionEvent:connect(function(position)
ChatWindow.GuiObject.Position = position
end)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.