prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
-- Connect mobile sprint button state change to update walk speed |
if UserInputService.TouchEnabled then
while task.wait(0.1) do
updateWalkSpeed()
end
end
|
-- Shows initial value if anything is currently in the CurrencyToCollect | |
--solves the problem of tools falling thru houses |
local connectedtools = {}
function GetConnection(tool)
for _,v in pairs(connectedtools) do
if v == tool then
return true
end
end
return false
end
game.Players.PlayerAdded:connect(function(plr)
plr.CharacterAdded:connect(function(char)
char.ChildAdded:connect(function(child)
if child:IsA("Tool") and not GetConnection(child) then
child.Changed:connect(function(property)
if child and child.Parent ~= nil and property == "Parent" then
wait(1/30)
local handle = child:FindFirstChild("Handle")
if child.Parent == workspace then
if handle and handle:CanSetNetworkOwnership() and plr then
handle:SetNetworkOwner(plr)
end
else
if handle and handle:CanSetNetworkOwnership() and plr then
handle:SetNetworkOwnershipAuto()
end
end
end
end)
table.insert(connectedtools,child)
end
end)
end)
end)
while true do --clean table
wait(1)
for i,v in pairs(connectedtools) do
if v.Parent == nil then
connectedtools[i] = nil
end
end
end
|
------------------------------------------Gun info |
wait(1)
ToolName="M4"
ClipSize=30
ReloadTime=0
Firerate= 0
MinSpread=0.001
MaxSpread=0.0015
SpreadRate=0
Bulletdrop = 0.00001
automatic = false
burst = false
shot = true
Tool = script.Parent
enabled = true
local skateboardId = 65068906
local arms = nil
local torso = nil
local weld33 = nil -- right arm
local weld55 = nil -- left arm
local welds = {}
BarrlePos=Vector3.new(0,0,0)Cursors={"http://www.roblox.com/asset/?id=47894837"}
ReloadCursor="rbxasset://textures\\GunWaitCursor.png"
barrel_1 = script.Parent:findFirstChild("barrelpos1") or script.Parent.Handle
barrel_2 = script.Parent:findFirstChild("barrelpos2") or script.Parent.Handle
double = false --Double Wielded
doublemode = 1 -- 1 is alternating, 2 is both
|
-- Decompiled with the Synapse X Luau decompiler. |
local u1 = Random.new();
return function(...)
local v14
local v1 = { ... };
if #v1 < 2 then
return v1[1] and v1[1][1];
end;
local v2 = u1:NextNumber();
(function()
local v3 = 0;
for v4, v5 in ipairs(v1) do
if not v4 then
break;
end;
v3 = v3 + v5[2];
end;
for v7, v8 in ipairs(v1) do
if not v7 then
break;
end;
v8[2] = v8[2] / v3;
end;
end)();
local v10 = 0;
for v11, v12 in ipairs(v1) do
if not v11 then
v14 = nil;
break;
end;
v10 = v10 + v12[2];
if v2 <= v10 then
v14 = v12;
break;
end;
end;
return v14[1], v2;
end;
|
--[[
Main RenderStep Update. The camera controller and occlusion module both have opportunities
to set and modify (respectively) the CFrame and Focus before it is set once on CurrentCamera.
The camera and occlusion modules should only return CFrames, not set the CFrame property of
CurrentCamera directly.
--]] |
local last=CFrame.new()
function CameraModule:Update(dt)
--local Framerate = dt / (1/60)
if self.activeCameraController then
if FFlagUserCameraToggle then
self.activeCameraController:UpdateMouseBehavior()
end
local newCameraCFrame, newCameraFocus = self.activeCameraController:Update(dt)
self.activeCameraController:ApplyVRTransform()
if self.activeOcclusionModule then
newCameraCFrame, newCameraFocus = self.activeOcclusionModule:Update(dt, newCameraCFrame, newCameraFocus)
end
Players.LocalPlayer.CAM.Value=newCameraCFrame
local new=newCameraCFrame
-- Here is where the new CFrame and Focus are set for this render frame
if _G.COFF then
local off=_G.COFF or CFrame.new()
game.Workspace.CurrentCamera.CFrame = last:lerp(new*off,0.4)--newCameraCFrame
else
workspace.CurrentCamera.CFrame = newCameraCFrame
end
game.Workspace.CurrentCamera.Focus = newCameraFocus
last=new
-- Update to character local transparency as needed based on camera-to-subject distance
if self.activeTransparencyController then
self.activeTransparencyController:Update()
end
end
end
|
--// All global vars will be wiped/replaced except script |
return function(data, env)
if env then
setfenv(1, env)
end
local playergui = service.PlayerGui
local localplayer = service.Players.LocalPlayer
local gui = service.New("ScreenGui")
local toggle = service.New("ImageButton", gui)
local gTable = client.UI.Register(gui)
local clickSound = service.New("Sound")
clickSound.Parent = toggle
clickSound.Volume = 0.25
clickSound.SoundId = "rbxassetid://156286438"
if client.UI.Get("HelpButton", gui, true) then
gui:Destroy()
gTable:Destroy()
return nil
end
gTable.Name = "HelpButton"
gTable.CanKeepAlive = false
toggle.Name = "Toggle"
toggle.BackgroundTransparency = 1
toggle.Position = UDim2.new(1, -45, 1, -45)
toggle.Size = UDim2.new(0, 40, 0, 40)
toggle.Image = client.HelpButtonImage
toggle.ImageTransparency = 0.35
toggle.Modal = client.Variables.ModalMode
toggle.ClipsDescendants = true
--if client.UI.Get("Chat") then
-- toggle.Position = UDim2.new(1, -(45+40),1, -45)
--end
toggle.MouseButton1Down:Connect(function()
spawn(function()
local effect = Instance.new("ImageLabel", toggle)
effect.AnchorPoint = Vector2.new(0.5, 0.5)
effect.BorderSizePixel = 0
effect.ZIndex = toggle.ZIndex + 1
effect.BackgroundTransparency = 1
effect.ImageTransparency = 0.8
effect.Image = "rbxasset://textures/whiteCircle.png"
effect.Position = UDim2.new(0.5, 0, 0.5, 0)
effect:TweenSize(UDim2.new(0, toggle.AbsoluteSize.X * 2.5, 0, toggle.AbsoluteSize.X * 2.5), Enum.EasingDirection.Out, Enum.EasingStyle.Linear, 0.2)
wait(0.2)
effect:Destroy()
end)
local found = client.UI.Get("UserPanel",nil,true)
if found then
found.Object:Destroy()
else
clickSound:Play()
client.UI.Make("UserPanel",{})
end
end)
gTable:Ready()
end
|
-- When player joins, have them spawn at the lobby |
local function onPlayerJoin(player)
LeaderboardManager.new(player)
end |
--Torso |
MakeWeld(car.Misc.Anims.R15.Torso.LowerTorso.X,car.DriveSeat,"Motor6D").Name="M"
MakeWeld(car.Misc.Anims.R15.Torso.LowerTorso.Z,car.Misc.Anims.R15.Torso.LowerTorso.X,"Motor6D").Name="M"
MakeWeld(car.Misc.Anims.R15.Torso.LowerTorso.Y,car.Misc.Anims.R15.Torso.LowerTorso.Z,"Motor6D").Name="M"
ModelWeld(car.Misc.Anims.R15.Torso.LowerTorso.Parts,car.Misc.Anims.R15.Torso.LowerTorso.Y)
MakeWeld(car.Misc.Anims.R15.Torso.UpperTorso.Z,car.Misc.Anims.R15.Torso.LowerTorso.Y,"Motor6D").Name="M"
ModelWeld(car.Misc.Anims.R15.Torso.UpperTorso.Parts,car.Misc.Anims.R15.Torso.UpperTorso.Z)
|
-- Request limit bookkeeping: |
local Budgets = {}
local budgetRequestQueues = {
[Enum.DataStoreRequestType.GetAsync] = {};
[Enum.DataStoreRequestType.GetSortedAsync] = {};
[Enum.DataStoreRequestType.OnUpdate] = {};
[Enum.DataStoreRequestType.SetIncrementAsync] = {};
[Enum.DataStoreRequestType.SetIncrementSortedAsync] = {};
}
local function initBudget()
for requestType, const in pairs(ConstantsMapping) do
Budgets[requestType] = const.START
end
Budgets[Enum.DataStoreRequestType.UpdateAsync] = math.min(
Budgets[Enum.DataStoreRequestType.GetAsync],
Budgets[Enum.DataStoreRequestType.SetIncrementAsync]
)
end
local function updateBudget(req, const, dt, n)
if not Constants.BUDGETING_ENABLED then
return
end
local rate = const.RATE + n * const.RATE_PLR
Budgets[req] = math.min(
Budgets[req] + dt * rate,
const.MAX_FACTOR * rate
)
end
local function stealBudget(budget)
if not Constants.BUDGETING_ENABLED then
return
end
for _, requestType in pairs(budget) do
if Budgets[requestType] then
Budgets[requestType] = math.max(0, Budgets[requestType] - 1)
end
end
Budgets[Enum.DataStoreRequestType.UpdateAsync] = math.min(
Budgets[Enum.DataStoreRequestType.GetAsync],
Budgets[Enum.DataStoreRequestType.SetIncrementAsync]
)
end
local function checkBudget(budget)
if not Constants.BUDGETING_ENABLED then
return true
end
for _, requestType in pairs(budget) do
if Budgets[requestType] and Budgets[requestType] < 1 then
return false
end
end
return true
end
if RunService:IsServer() then
-- Only do budget/throttle updating on server (in case package required on client)
initBudget()
delay(0, function() -- Thread that increases budgets and de-throttles requests periodically
local lastCheck = tick()
while wait(Constants.BUDGET_UPDATE_INTERVAL) do
local now = tick()
local dt = (now - lastCheck) / 60
lastCheck = now
local n = #Players:GetPlayers()
for requestType, const in pairs(ConstantsMapping) do
updateBudget(requestType, const, dt, n)
end
Budgets[Enum.DataStoreRequestType.UpdateAsync] = math.min(
Budgets[Enum.DataStoreRequestType.GetAsync],
Budgets[Enum.DataStoreRequestType.SetIncrementAsync]
)
for _, budgetRequestQueue in pairs(budgetRequestQueues) do
for i = #budgetRequestQueue, 1, -1 do
local request = budgetRequestQueue[i]
local thread = request.Thread
local budget = request.Budget
local key = request.Key
local lock = request.Lock
local cache = request.Cache
if not (lock and (lock[key] or tick() - (cache[key] or 0) < Constants.WRITE_COOLDOWN)) and checkBudget(budget) then
table.remove(budgetRequestQueue, i)
stealBudget(budget)
coroutine.resume(thread)
end
end
end
end
end)
game:BindToClose(function()
for requestType, const in pairs(ConstantsMapping) do
Budgets[requestType] = math.max(
Budgets[requestType],
Constants.BUDGET_ONCLOSE_BASE * (const.RATE / Constants.BUDGET_BASE)
)
end
Budgets[Enum.DataStoreRequestType.UpdateAsync] = math.min(
Budgets[Enum.DataStoreRequestType.GetAsync],
Budgets[Enum.DataStoreRequestType.SetIncrementAsync]
)
end)
end
function MockDataStoreManager.GetGlobalData()
return Data.GlobalDataStore
end
function MockDataStoreManager.GetData(name, scope)
assert(type(name) == "string")
assert(type(scope) == "string")
if not Data.DataStore[name] then
Data.DataStore[name] = {}
end
if not Data.DataStore[name][scope] then
Data.DataStore[name][scope] = {}
end
return Data.DataStore[name][scope]
end
function MockDataStoreManager.GetOrderedData(name, scope)
assert(type(name) == "string")
assert(type(scope) == "string")
if not Data.OrderedDataStore[name] then
Data.OrderedDataStore[name] = {}
end
if not Data.OrderedDataStore[name][scope] then
Data.OrderedDataStore[name][scope] = {}
end
return Data.OrderedDataStore[name][scope]
end
function MockDataStoreManager.GetDataInterface(data)
return Interfaces[data]
end
function MockDataStoreManager.SetDataInterface(data, interface)
assert(type(data) == "table")
assert(type(interface) == "table")
Interfaces[data] = interface
end
function MockDataStoreManager.GetBudget(requestType)
if Constants.BUDGETING_ENABLED then
return math.floor(Budgets[requestType] or 0)
else
return math.huge
end
end
function MockDataStoreManager.YieldForWriteLockAndBudget(callback, key, writeLock, writeCache, budget)
assert(type(callback) == "function")
assert(type(key) == "string")
assert(type(writeLock) == "table")
assert(type(writeCache) == "table")
assert(#budget > 0)
local mainRequestType = budget[1]
if #budgetRequestQueues[mainRequestType] >= Constants.THROTTLE_QUEUE_SIZE then
return false -- no room in throttle queue
end
callback() -- would i.e. trigger a warning in output
table.insert(budgetRequestQueues[mainRequestType], 1, {
Key = key;
Lock = writeLock;
Cache = writeCache;
Thread = coroutine.running();
Budget = budget;
})
coroutine.yield()
return true
end
function MockDataStoreManager.YieldForBudget(callback, budget)
assert(type(callback) == "function")
assert(#budget > 0)
local mainRequestType = budget[1]
if checkBudget(budget) then
stealBudget(budget)
elseif #budgetRequestQueues[mainRequestType] >= Constants.THROTTLE_QUEUE_SIZE then
return false -- no room in throttle queue
else
callback() -- would i.e. trigger a warning in output
table.insert(budgetRequestQueues[mainRequestType], 1, {
After = 0; -- no write lock
Thread = coroutine.running();
Budget = budget;
})
coroutine.yield()
end
return true
end
function MockDataStoreManager.ExportToJSON()
local export = {}
if next(Data.GlobalDataStore) ~= nil then -- GlobalDataStore not empty
export.GlobalDataStore = Data.GlobalDataStore
end
export.DataStore = Utils.prepareDataStoresForExport(Data.DataStore) -- can be nil
export.OrderedDataStore = Utils.prepareDataStoresForExport(Data.OrderedDataStore) -- can be nil
return HttpService:JSONEncode(export)
end
|
--detect when player sits, tell player to press space to jump, detect when player presses space. Then remove the intructions |
if IsNewPlayer and not UIS.TouchEnabled then
script.Parent.Changed:connect(function(prop)
if prop == "Visible" and not UIS.TouchEnabled then
if script.Parent.Visible then
keyboardInput = UIS.InputBegan:connect(function(input,gameProcessed)
if input.UserInputType == Enum.UserInputType.Keyboard and input.KeyCode == Enum.KeyCode.Space then
script.Parent:Destroy()
end
end)
wait(7)
script.Parent.Visible = false
else
if keyboardInput then keyboardInput:disconnect() keyboardInput = nil end
end
end
end)
local humanoid = game.Players.LocalPlayer.Character:WaitForChild("Humanoid",5)
humanoid.Seated:connect(function(active,seat)
if active and seat and seat.Parent then
if not ShowedExitMessage and seat.Name == "Driver" then
script.Parent.Frame.TextLabel.Text = "Exit Car"
ShowedExitMessage = true
wait(2)
script.Parent.Visible = true
elseif not ShowedStandMessage and seat.Name ~= "Driver" then
script.Parent.Frame.TextLabel.Text = "Stand Up"
ShowedStandMessage = true
wait(.5)
script.Parent.Visible = true
end
end
end)
else
script.Parent:Destroy()
end
|
--MOT is up and down while MOT2 is side to side |
wt = 0.07
while wait(0.01) do
if values.Gear.Value == -1 then
MOT2.DesiredAngle = -0.2
wait(wt)
MOT.DesiredAngle = 0.2
end
if values.Gear.Value == 0 then
MOT.DesiredAngle = 0
wait(wt)
MOT2.DesiredAngle = 0
end
if values.Gear.Value == 1 then
MOT2.DesiredAngle = 0.2
wait(wt)
MOT.DesiredAngle = -0.2
end
if values.Gear.Value == 2 then
MOT.DesiredAngle = 0.2
wait(wt)
MOT2.DesiredAngle = 0.2
end
if values.Gear.Value == 3 then
MOT.DesiredAngle = -0.2
wait(wt)
MOT2.DesiredAngle = 0
end
if values.Gear.Value == 4 then
MOT.DesiredAngle = 0.2
wait(wt)
MOT2.DesiredAngle = 0
end
if values.Gear.Value == 5 then
MOT.DesiredAngle = -0.2
wait(wt)
MOT2.DesiredAngle = -0.2
end
if values.Gear.Value == 6 then
MOT.DesiredAngle = 0.2
wait(wt)
MOT2.DesiredAngle = -0.2
end
end
|
--make blood disappear |
while script.Parent.Mesh.Scale.X<1 do
game:GetService("RunService").Stepped:wait()
script.Parent.Mesh.Scale=Vector3.new(script.Parent.Mesh.Scale.X+0.05,0.1,script.Parent.Mesh.Scale.Z+0.05)
end
wait(math.random(5,20))
while script.Parent.Decal.Transparency<1 do
game:GetService("RunService").Stepped:wait()
script.Parent.Decal.Transparency=script.Parent.Decal.Transparency+.1
end
script.Parent:remove()
|
--griptcf = CFrame.new(0, -1, 0) * CFrame.fromEulerAnglesXYZ(-math.pi/2+0.5, 0, 0) |
script.Parent.Unequipped:connect(function()
--Bring_Arm_Down animation
for i = 1, 0, -0.05 do
wait()
RW.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(1.3*i, 0, -0.5*i)
LW.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(1.7*i, 0, 0.8*i)
LW.C1 = CFrame.new(-0.3*i, 0.5+1.2*i, 0)
end
RW.Parent = nil
LW.Parent = nil
RSH.Parent = player.Character.Torso
LSH.Parent = player.Character.Torso
end)
function HomeRunHit(part)
local h = (part.Parent or game):FindFirstChild("Humanoid") --or findfirstchild optimization
if h then
h.Sit = true
wait()
h.Jump = true
h.Parent.Torso.Velocity = (CFrame.new(script.Parent.Handle.Position, h.Parent.Torso.Position).lookVector * 100) + Vector3.new(0, 30, 0)
h.Parent.Torso.RotVelocity = Vector3.new(math.random(-100, 100), math.random(-100, 100), math.random(-100, 100))
end
end
function HomeRun()
for i = 0, 1, 0.1 do
if anim ~= "homerun" then return end
wait()
RW.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(1.3+1.2*i, -0.5*i, -0.5+i)
--R.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(2.5, -0.5, 0.5)
LW.C0 = CFrame.new(-1.5+0.5*i, 0.5, -0.5*i) * CFrame.fromEulerAnglesXYZ(1.7, 0, 0.8)
--L.C0 = CFrame.new(-1.0, 0.5, -0.5) * CFrame.fromEulerAnglesXYZ(1.7, 0, 1)
end
--start homerunhit connection--
local con = script.Parent.Handle.Touched:connect(HomeRunHit)
----------------------------------------
for i = 0, 1, 0.2 do
wait()
RW.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(2.5, -0.5-1.7*i, 0.5+0.5*i)
--R.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(2.5, -2.2, 1)
LW.C0 = CFrame.new(-1-0.5*i, 0.5, -0.5+0.5*i) * CFrame.fromEulerAnglesXYZ(1.7, 0, 0.8-1.2*i)
LW.C1 = CFrame.new(0, 0.5-i, 0)
GRP.C0 = CFrame.new(0, -1, 0) * CFrame.fromEulerAnglesXYZ(-1-2*i, 0, 0)
end
for i = 0, 1, 0.2 do
wait()
RW.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(2.5, -2.2-0.6*i, 1)
end
wait(0.1)
----end homerun connection---
con:disconnect()
--------------------------------------
for i = 0, 1, 0.1 do
wait()
RW.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(2.5-1.2*i, -2.8+2.8*i, 1-1.5*i)
--RW.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(1.3, 0, -0.5)
LW.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(1.7, 0, -0.4+1.2*i)
LW.C1 = CFrame.new(0, -0.5+i*2, 0)
--LW.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(1.7, 0, 0.8)
GRP.C0 = CFrame.new(0, -1, 0) * CFrame.fromEulerAnglesXYZ(-3+2*i, 0, 0)
end
end
function Whack()
for i = 0, 1, 0.2 do
if anim ~= "norm" then return end
wait()
RW.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(1.3+i, 0, -0.5+0.5*i)
LW.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(1.7-0.25*i, 0, 0.8-0.6*i)
end
for i = 0, 1, 0.25 do
if anim ~= "norm" then return end
wait()
RW.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(2.3-2.5*i, 0, 0)
LW.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(1.45-0.25*i, 0, 0.2)
GRP.C0 = CFrame.new(0, -1, 0) * CFrame.fromEulerAnglesXYZ(-1-0.5*i, 0, 0)
end
--insert camshake and hit nearby people
for _, p in pairs(game.Players:GetChildren()) do
if p.Character:FindFirstChild("Torso") then
if (p.Character.Torso.Position - (script.Parent.Handle.CFrame*CFrame.new(0, -3, 0)).p).magnitude < 10 then
local s = script.Parent._CamShake:clone()
s.Disabled = false
s.Parent = p.Backpack
if p ~= player then
p.Character.Humanoid.Sit = true
delay(0.1, function() p.Character.Humanoid.Jump = true end)
p.Character.Torso.RotVelocity = Vector3.new(math.random(-10, 10), math.random(-10, 10), math.random(-10, 10))
end
end
end
end
------
for i = 0, 1, 0.2 do
if anim ~= "norm" then return end
wait()
RW.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(-0.2+1.5*i, 0, -0.5*i)
LW.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(1.2+0.5*i, 0, 0.2+0.6*i)
GRP.C0 = CFrame.new(0, -1, 0) * CFrame.fromEulerAnglesXYZ(-1.5+0.5*i, 0, 0)
end
end
local a = false
local co = nil |
--[[Wheel Configuration]] |
--Store Reference Orientation Function
function getParts(model,t,a)
for i,v in pairs(model:GetChildren()) do
if v:IsA("BasePart") then table.insert(t,{v,a.CFrame:toObjectSpace(v.CFrame)})
elseif v:IsA("Model") then getParts(v,t,a)
end
end
end
--PGS/Legacy
local fDensity = _Tune.FWheelDensity
local rDensity = _Tune.RWheelDensity
local fDistX=_Tune.FWsBoneLen*math.cos(math.rad(_Tune.FWsBoneAngle))
local fDistY=_Tune.FWsBoneLen*math.sin(math.rad(_Tune.FWsBoneAngle))
local rDistX=_Tune.RWsBoneLen*math.cos(math.rad(_Tune.RWsBoneAngle))
local rDistY=_Tune.RWsBoneLen*math.sin(math.rad(_Tune.RWsBoneAngle))
local fSLX=_Tune.FSusLength*math.cos(math.rad(_Tune.FSusAngle))
local fSLY=_Tune.FSusLength*math.sin(math.rad(_Tune.FSusAngle))
local rSLX=_Tune.RSusLength*math.cos(math.rad(_Tune.RSusAngle))
local rSLY=_Tune.RSusLength*math.sin(math.rad(_Tune.RSusAngle))
for _,v in pairs(Drive) do
--Apply Wheel Density
if v.Name=="FL" or v.Name=="FR" or v.Name=="F" then
if v:IsA("BasePart") then
if v.CustomPhysicalProperties == nil then v.CustomPhysicalProperties = PhysicalProperties.new(v.Material) end
v.CustomPhysicalProperties = PhysicalProperties.new(
fDensity,
v.CustomPhysicalProperties.Friction,
v.CustomPhysicalProperties.Elasticity,
v.CustomPhysicalProperties.FrictionWeight,
v.CustomPhysicalProperties.ElasticityWeight
)
end
else
if v:IsA("BasePart") then
if v.CustomPhysicalProperties == nil then v.CustomPhysicalProperties = PhysicalProperties.new(v.Material) end
v.CustomPhysicalProperties = PhysicalProperties.new(
rDensity,
v.CustomPhysicalProperties.Friction,
v.CustomPhysicalProperties.Elasticity,
v.CustomPhysicalProperties.FrictionWeight,
v.CustomPhysicalProperties.ElasticityWeight
)
end
end
--Resurface Wheels
for _,a in pairs({"Top","Bottom","Left","Right","Front","Back"}) do
v[a.."Surface"]=Enum.SurfaceType.SmoothNoOutlines
end
--Store Axle-Anchored/Suspension-Anchored Part Orientation
local WParts = {}
local tPos = v.Position-car.DriveSeat.Position
if v.Name=="FL" or v.Name=="RL" then
v.CFrame = car.DriveSeat.CFrame*CFrame.Angles(math.rad(90),0,math.rad(90))
else
v.CFrame = car.DriveSeat.CFrame*CFrame.Angles(math.rad(90),0,math.rad(-90))
end
v.CFrame = v.CFrame+tPos
if v:FindFirstChild("Parts")~=nil then
getParts(v.Parts,WParts,v)
end
if v:FindFirstChild("Fixed")~=nil then
getParts(v.Fixed,WParts,v)
end
--Align Wheels
if v.Name=="FL" then
v.CFrame = v.CFrame*CFrame.Angles(math.rad(_Tune.FCamber),math.rad(-_Tune.FCaster),math.rad(_Tune.FToe))
elseif v.Name=="FR" then
v.CFrame = v.CFrame*CFrame.Angles(math.rad(_Tune.FCamber),math.rad(_Tune.FCaster),math.rad(-_Tune.FToe))
elseif v.Name=="RL" then
v.CFrame = v.CFrame*CFrame.Angles(math.rad(_Tune.RCamber),math.rad(-_Tune.FCaster),math.rad(_Tune.RToe))
elseif v.Name=="RR" then
v.CFrame = v.CFrame*CFrame.Angles(math.rad(_Tune.RCamber),math.rad(_Tune.FCaster),math.rad(-_Tune.RToe))
end
--Re-orient Axle-Anchored/Suspension-Anchored Parts
for _,a in pairs(WParts) do
a[1].CFrame=v.CFrame:toWorldSpace(a[2])
end
|
-- child.C0 = CFrame.new(0,-0.6,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0) --// Reposition player |
if child.Part1.Name == "HumanoidRootPart" then
player = game.Players:GetPlayerFromCharacter(child.Part1.Parent)
if player and (not player.PlayerGui:FindFirstChild("Screen")) then --// The part after the "and" prevents multiple GUI's to be copied over.
GUI.CarSeat.Value = script.Parent --// Puts a reference of the seat in this ObjectValue, now you can use this ObjectValue's value to find the car directly.
GUI:Clone().Parent = player.PlayerGui --// Compact version
script.Parent.Parent.Body.Lights.Runner.Material = "Neon"
script.Parent.Parent.Body.Dash.Screen.SurfaceGui.Enabled = true
script.Parent.Parent.Body.Dash.Screen2.SurfaceGui.Enabled = true
script.Parent.Occupied.Value = true
end
end
end
end)
script.Parent.ChildRemoved:connect(function(child)
if child:IsA("Weld") then
if child.Part1.Name == "HumanoidRootPart" then
game.Workspace.CurrentCamera.FieldOfView = 70
player = game.Players:GetPlayerFromCharacter(child.Part1.Parent)
if player and player.PlayerGui:FindFirstChild("SS3") then
player.PlayerGui:FindFirstChild("SS3"):Destroy()
script.Parent.Parent.Body.Lights.Runner.Material = "SmoothPlastic"
script.Parent.Parent.Body.Dash.Screen.SurfaceGui.Enabled = false
script.Parent.Parent.Body.Dash.Screen2.SurfaceGui.Enabled = false
script.Parent.Occupied.Value = false
end
end
end
end)
|
-- Right Arms |
character.RagdollRig.ConstraintRightUpperArm.Attachment0 = RUA
character.RagdollRig.ConstraintRightUpperArm.Attachment1 = RUARig
character.RagdollRig.ConstraintRightLowerArm.Attachment0 = RLA
character.RagdollRig.ConstraintRightLowerArm.Attachment1 = RLARig
character.RagdollRig.ConstraintRightHand.Attachment0 = RH
character.RagdollRig.ConstraintRightHand.Attachment1 = RHRig |
-- Roact |
local new = Roact.createElement
local NotificationDialog = require(script:WaitForChild('NotificationDialog'))
|
--[=[
Returns if the pane is visible
@return boolean
]=] |
function BasicPane:IsVisible()
return self._visible
end
|
--local PurchaseActive = false
--local MPS = game:GetService("MarketplaceService")
--local Players = game:GetService("Players")
--local Cart = {}
--local IsRobuxPurchaseActive = false
--local WasPurchaseDeclined = false
--script.Parent.Cart.Buy.MouseButton1Click:Connect(function()
-- script.Parent.Cart.Warning.Visible = true
--end)
--script.Parent.Cart.Warning.No.MouseButton1Click:Connect(function()
-- script.Parent.Cart.Warning.Visible = false
--end) | |
---------------------------
--[[
--Main anchor point is the DriveSeat <car.DriveSeat>
Usage:
MakeWeld(Part1,Part2,WeldType*,MotorVelocity**) *default is "Weld" **Applies to Motor welds only
ModelWeld(Model,MainPart)
Example:
MakeWeld(car.DriveSeat,misc.PassengerSeat)
MakeWeld(car.DriveSeat,misc.SteeringWheel,"Motor",.2)
ModelWeld(car.DriveSeat,misc.Door)
]]
--Weld stuff here |
MakeWeld(car.DriveSeat,misc:WaitForChild('Aero'))
car.DriveSeat.ChildAdded:connect(function(child)
if child.Name=="SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
child.C0=CFrame.new(0,-.5,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0)*CFrame.Angles(math.rad(13),0,0)
end
end)
ModelWeld(misc.UI.Model,misc.UI.Shrowd)
MakeWeld(misc.UI.Motor,misc.UI.Shrowd)
MakeWeld(misc.UI.Motor2,misc.UI.Shrowd)
MakeWeld(car.DriveSeat,misc.UI.Shrowd)
MakeWeld(misc.UI.Motor,misc.UI.Needle).Name="W1"
MakeWeld(misc.UI.Motor2,misc.UI.RPM).Name="W2"
MakeWeld(misc.UI.Motor2,misc.UI.Redline,"Motor",.03).Name="W3" |
-- Create the enemy death event handler |
game.Workspace.OnCharacterAdded:Connect(function(character)
-- Check if the character is an enemy
if character:FindFirstChild("Humanoid") and character:FindFirstChild("Enemy") then
-- Remove the enemy from the game state
for i, enemy in pairs(gameState.enemies) do
if enemy == character then
table.remove(gameState.enemies, i)
break
end
end
-- Check if the level is complete
if #gameState.enemies == 0 then
-- Load the next level
loadLevel(gameState.level + 1)
end
end
end)
|
-- Decompiled with the Synapse X Luau decompiler. |
function Click()
script.Parent.Parent.ScrollingFrame.Visible = false;
script.Parent.Visible = false;
end;
script.Parent.MouseButton1Down:connect(Click);
|
--[=[
Converts an arbitrary value to a LinearValue if Roblox has not defined this value
for multiplication and addition.
@param value T
@return LinearValue<T> | T
]=] |
function SpringUtils.toLinearIfNeeded(value)
if typeof(value) == "Color3" then
return LinearValue.new(Color3.new, {value.r, value.g, value.b})
elseif typeof(value) == "UDim2" then
return LinearValue.new(UDim2.new, {value.x.scale, value.x.offset, value.y.scale, value.y.offset})
elseif typeof(value) == "UDim" then
return LinearValue.new(UDim.new, {value.scale, value.offset})
else
return value
end
end
|
--// ACLI - Adonis Client Loading Initializer |
if true then return end --// #DISABLED
local DebugMode = false
local otime = os.time
local time = time
local game = game
local pcall = pcall
local xpcall = xpcall
local error = error
local type = type
local print = print
local assert = assert
local string = string
local setfenv = setfenv
local getfenv = getfenv
local require = require
local tostring = tostring
local coroutine = coroutine
local Instance = Instance
local script = script
local select = select
local unpack = unpack
local spawn = spawn
local debug = debug
local pairs = pairs
local wait = wait
local next = next
local time = time
local finderEvent
local realWarn = warn
local realPrint = print
local foundClient = false
local checkedChildren = {}
local replicated = game:GetService("ReplicatedFirst")
local runService = game:GetService("RunService")
local player = game:GetService("Players").LocalPlayer
local Kick = player.Kick
local start = time()
local checkThese = {}
local services = {
"Chat";
"Teams";
"Players";
"Workspace";
"LogService";
"TestService";
"InsertService";
"SoundService";
"StarterGui";
"StarterPack";
"StarterPlayer";
"ReplicatedFirst";
"ReplicatedStorage";
"JointsService";
"Lighting";
}
local function print(...)
--realPrint(...)
end
local function warn(str)
if DebugMode or player.UserId == 1237666 then
realWarn("ACLI: "..tostring(str))
end
end
local function Kill(info)
if DebugMode then warn(info) return end
pcall(function() Kick(player, info) end)
wait(1)
pcall(function() while not DebugMode and wait() do pcall(function() while true do end end) end end)
end
local function Locked(obj)
return (not obj and true) or not pcall(function() return obj.GetFullName(obj) end)
end
local function callCheck(child)
warn("CallCheck: "..tostring(child))
if Locked(child) then
warn("Child locked?")
Kill("ACLI: Locked")
else
warn("Child not locked")
xpcall(function()
return child[{}]
end, function()
if getfenv(1) ~= getfenv(2) then
Kill("ACLI: Error")
end
end)
end
end
local function doPcall(func, ...)
local ran,ret = pcall(func, ...)
if ran then
return ran,ret
else
warn(tostring(ret))
Kill("ACLI: Error\n"..tostring(ret))
return ran,ret
end
end
local function lockCheck(obj)
callCheck(obj)
obj.Changed:Connect(function(p)
warn("Child changed; Checking...")
callCheck(obj)
end)
end
local function loadingTime()
warn("LoadingTime Called")
setfenv(1,{})
warn(tostring(time() - start))
end
local function checkChild(child)
warn("Checking child: ".. tostring(child and child.ClassName) .." : ".. tostring(child and child:GetFullName()))
callCheck(child)
if child and not foundClient and not checkedChildren[child] and child:IsA("Folder") and child.Name == "Adonis_Client" then
warn("Loading Folder...")
local nameVal
local origName
local depsFolder
local clientModule
local oldChild = child
local container = child.Parent
warn("Adding child to checked list & setting parent...")
checkedChildren[child] = true
warn("Waiting for Client & Special")
nameVal = child:WaitForChild("Special", 30)
clientModule = child:WaitForChild("Client", 30)
warn("Checking Client & Special")
callCheck(nameVal)
callCheck(clientModule)
warn("Getting origName")
origName = (nameVal and nameVal.Value) or child.Name
warn("Got name: "..tostring(origName))
warn("Changing child parent...")
child.Parent = nil
warn("Destroying parent...")
if container and container:IsA("ScreenGui") and container.Name == "Adonis_Container" then
spawn(function()
wait(0.5);
container:Destroy();
end)
end
if clientModule and clientModule:IsA("ModuleScript") then
print("Debug: Loading the client?")
local meta = require(clientModule)
warn("Got metatable: "..tostring(meta))
if meta and type(meta) == "userdata" and tostring(meta) == "Adonis" then
local ran,ret = pcall(meta,{
Module = clientModule,
Start = start,
Loader = script,
Name = origName,
LoadingTime = loadingTime,
CallCheck = callCheck,
Kill = Kill
})
warn("Got return: "..tostring(ret))
if ret ~= "SUCCESS" then
warn(ret)
Kill("ACLI: Loading Error [Bad Module Return]")
else
print("Debug: The client was found and loaded?")
warn("Client Loaded")
oldChild:Destroy()
child.Parent = nil
foundClient = true
if finderEvent then
finderEvent:Disconnect()
finderEvent = nil
end
end
end
end
end
end
local function scan(folder)
warn("Scanning for client...")
if not doPcall(function()
for i,child in next,folder:GetChildren() do
if child.Name == "Adonis_Container" then
local client = child:FindFirstChildOfClass("Folder") or child:WaitForChild("Adonis_Client", 5);
if client then
doPcall(checkChild, client);
end
end
end
end) then warn("Scan failed?") Kick(player, "ACLI: Loading Error [Scan failed]"); end
end
|
--> FUNCTIONS |
Flare.Activated:Connect(function()
if not Reloading then
Reloading = true
Player.Character.Humanoid:LoadAnimation(FireAnim):Play(.1, 1, FireAnimationSpeed)
local Mouse = Player:GetMouse()
ClickedEvent:FireServer(Mouse.Hit.Position)
wait(.5)
Player.Character.Humanoid:LoadAnimation(ReloadAnim):Play(.1, 1, ReloadAnimationSpeed)
wait(ReloadTime)
Reloading = false
end
end)
|
-- Local Functions |
local function OnActivation()
if Player.Character.Humanoid:GetState() == Enum.HumanoidStateType.Swimming then return end
if CanFire then
CanFire = false
local rocket = table.remove(Buffer, 1)
rocket.Rocket.Transparency = 0
Tool.FireRocket:FireServer(rocket)
local toMouse = (Mouse.Hit.p - Handle.Position).unit
local direction = toMouse * 5
rocket.PrimaryPart.CFrame = CFrame.new(Handle.Position, Handle.Position + direction) + direction
rocket.PrimaryPart.Velocity = direction * 40
RocketManager:BindRocketEvents(rocket)
wait(Configurations.ReloadTimeSeconds.Value)
CanFire = true
end
end
local function OnStorageAdded(child)
table.insert(Buffer, child)
end
local function SetupJoints()
local torso = Player.Character.Torso
Neck = torso.Neck
OldNeckC0 = Neck.C0
Shoulder = torso['Right Shoulder']
OldShoulderC0 = Shoulder.C0
end
local function Frame(mousePosition)
if Player.Character.Humanoid:GetState() == Enum.HumanoidStateType.Swimming then return end
local torso = Player.Character.HumanoidRootPart
local head = Player.Character.Head
local toMouse = (mousePosition - head.Position).unit
local angle = math.acos(toMouse:Dot(Vector3.new(0,1,0)))
local neckAngle = angle
-- Limit how much the head can tilt down. Too far and the head looks unnatural
if math.deg(neckAngle) > 110 then
neckAngle = math.rad(110)
end
Neck.C0 = CFrame.new(0,1,0) * CFrame.Angles(math.pi - neckAngle,math.pi,0)
-- Calculate horizontal rotation
local arm = Player.Character['Right Arm']
local fromArmPos = torso.Position + torso.CFrame:vectorToWorldSpace(Vector3.new(
torso.Size.X/2 + arm.Size.X/2, torso.Size.Y/2 - arm.Size.Z/2, 0))
local toMouseArm = ((mousePosition - fromArmPos) * Vector3.new(1,0,1)).unit
local look = (torso.CFrame.lookVector * Vector3.new(1,0,1)).unit
local lateralAngle = math.acos(toMouseArm:Dot(look))
-- Check for rogue math
if tostring(lateralAngle) == "-1.#IND" then
lateralAngle = 0
end
-- Handle case where character is sitting down
if Player.Character.Humanoid:GetState() == Enum.HumanoidStateType.Seated then
local cross = torso.CFrame.lookVector:Cross(toMouseArm)
if lateralAngle > math.pi/2 then
lateralAngle = math.pi/2
end
if cross.Y < 0 then
lateralAngle = -lateralAngle
end
end
-- Turn shoulder to point to mouse
Shoulder.C0 = CFrame.new(1,0.5,0) * CFrame.Angles(math.pi/2 - angle,math.pi/2 + lateralAngle,0)
-- If not sitting then aim torso laterally towards mouse
if Player.Character.Humanoid:GetState() ~= Enum.HumanoidStateType.Seated then
torso.CFrame = CFrame.new(torso.Position, torso.Position + (Vector3.new(
mousePosition.X, torso.Position.Y, mousePosition.Z)-torso.Position).unit)
end
end
local function MouseFrame()
Frame(Mouse.Hit.p)
end
local function OnEquip()
-- Setup joint variables
SetupJoints()
-- Replace mouse icon and store old
OldMouseIcon = Mouse.Icon
Mouse.Icon = 'rbxassetid://79658449'
Mouse.TargetFilter = Player.Character
AutoRotate = Player.Character.Humanoid.AutoRotate
Player.Character.Humanoid.AutoRotate = false
RunService:BindToRenderStep('RotateCharacter', Enum.RenderPriority.Input.Value, MouseFrame)
end
local function OnUnequip()
Mouse.Icon = OldMouseIcon
Neck.C0 = OldNeckC0
Shoulder.C0 = OldShoulderC0
Player.Character.Humanoid.AutoRotate = AutoRotate
RunService:UnbindFromRenderStep('RotateCharacter')
end
|
--- VARIABLES/CONSTANTS --- |
Player = Players.LocalPlayer
Camera = workspace.CurrentCamera
isMobile = UserInputService.TouchEnabled
DirectionalKeys = {Enum.KeyCode.W, Enum.KeyCode.S, Enum.KeyCode.A, Enum.KeyCode.D}
LastDirectional = tick()
Locked = false
local Mobile
local LastKeyDown
|
-- Définir les objets MovingPart et Projection |
local Model = pp.Parent.Parent
local movingPart = Model.Slide
local projection = Model.Projection
local projection2 = Model.Projection2
|
-- Door Open/Close -- |
function Functions.Move(Status)
DoorLogo.Moving:Play()
Functions.CreateModelTween(Model.Door, TweenInfo.new(1.25), {Value = DoorSegment.CFrame * CFrame.new(Status and 6 or -6, 0, 0)})
if Status == false then
Model.Door:SetPrimaryPartCFrame(PositionSave)
end
DoorLogo.Moving:Stop()
DoorLogo.Closed:Play()
end
|
-- скрипт для приобретения GamePass |
local Players = game:GetService("Players")
localPlayer = Players.LocalPlayer
plr = Players:FindFirstChild(localPlayer.Name)
wait(10)
id = script.id.Value |
--RotatorSwitch |
function KeepRotatorActive()
repeat wait()
RotatorVal.Value = true
until RotatorSwch.Value == 1 or Power.Value == false
RotatorVal.Value = false
end
RotatorSwch.Changed:Connect(function()
if RotatorSwch.Value == 1 then
RotatorSwch.Parent.P1.Transparency = 0
RotatorSwch.Parent.P2.Transparency = 1
RotatorSwch.Parent.P3.Transparency = 1
RotatorVal.Off.Value = false
RotatorVal.Value = false
ClickSound:Play()
elseif RotatorSwch.Value == 2 then
RotatorSwch.Parent.P1.Transparency = 1
RotatorSwch.Parent.P2.Transparency = 0
RotatorSwch.Parent.P3.Transparency = 1
ClickSound:Play()
RotatorVal.Off.Value = true
else
ClickSound:Play()
RotatorSwch.Parent.P1.Transparency = 1
RotatorSwch.Parent.P2.Transparency = 1
RotatorSwch.Parent.P3.Transparency = 0
RotatorVal.Off.Value = false
if Power.Value == true then
KeepRotatorActive()
end
end
end)
BlowerSwch.Parent.SelectionObjectBrick.ProximityPrompt.Triggered:Connect(function()
if BlowerSwch.Value == true then
BlowerSwch.Parent.SelectionObjectBrick.ProximityPrompt.ActionText="Auto"
BlowerSwch.Value = false
else
BlowerSwch.Parent.SelectionObjectBrick.ProximityPrompt.ActionText="Test"
BlowerSwch.Value = true
end
end)
ChopperSwch.Parent.SelectionObjectBrick.ProximityPrompt.Triggered:Connect(function()
if ChopperSwch.Value == true then
ChopperSwch.Parent.SelectionObjectBrick.ProximityPrompt.ActionText="Auto"
ChopperSwch.Value = false
else
ChopperSwch.Parent.SelectionObjectBrick.ProximityPrompt.ActionText="Test"
ChopperSwch.Value = true
end
end)
ControlSwch.Parent.SelectionObjectBrick.ProximityPrompt.Triggered:Connect(function()
if ControlSwch.Value == true then
ControlSwch.Parent.SelectionObjectBrick.ProximityPrompt.ActionText="Auto"
ControlSwch.Value = false
else
ControlSwch.Parent.SelectionObjectBrick.ProximityPrompt.ActionText="Test"
ControlSwch.Value = true
end
end)
RotatorSwch.Parent.SelectionObjectBrick.ProximityPrompt.Triggered:Connect(function()
RotatorSwch.Value = RotatorSwch.Value + 1
if RotatorSwch.Value == 1 then
RotatorSwch.Parent.SelectionObjectBrick.ProximityPrompt.ActionText="Auto"
elseif RotatorSwch.Value == 2 then
RotatorSwch.Parent.SelectionObjectBrick.ProximityPrompt.ActionText="Off"
elseif RotatorSwch.Value == 3 then
RotatorSwch.Parent.SelectionObjectBrick.ProximityPrompt.ActionText="Test"
else
RotatorSwch.Value = 1
RotatorSwch.Parent.SelectionObjectBrick.ProximityPrompt.ActionText="Auto"
end
end)
function Lock()
if script.Parent.Locked.Value == true then
BlowerSwch.Parent.SelectionObjectBrick.ProximityPrompt.Enabled = false
ChopperSwch.Parent.SelectionObjectBrick.ProximityPrompt.Enabled = false
ControlSwch.Parent.SelectionObjectBrick.ProximityPrompt.Enabled = false
RotatorSwch.Parent.SelectionObjectBrick.ProximityPrompt.Enabled = false
else
BlowerSwch.Parent.SelectionObjectBrick.ProximityPrompt.Enabled = true
ChopperSwch.Parent.SelectionObjectBrick.ProximityPrompt.Enabled = true
ControlSwch.Parent.SelectionObjectBrick.ProximityPrompt.Enabled = true
RotatorSwch.Parent.SelectionObjectBrick.ProximityPrompt.Enabled = true
end
end
Lock()
script.Parent.Locked.Changed:Connect(function()
Lock()
end)
|
--[=[
Promises a property value
@class promisePropertyValue
]=] |
local require = require(script.Parent.loader).load(script)
local Promise = require("Promise")
|
--tune |
local PSI = 22
local Turbos = "Single" -- "Twin","Single"
local TurboSize = "Medium" -- "Small","Medium","Large"
local TwoStep = false
local Valve = "BOV" -- "BOV","Bleed" |
------------------------------------- |
equiped=false
sp=script.Parent
RayLength=100000
Spread=0
enabled=true
reloading=false
down=false
r=game:service("RunService")
last=0
last2=0
last3=0
last4=0
last5=0
last6=0
Bullet=Instance.new("Part")
Bullet.Name="Bullet"
Bullet.BrickColor=BrickColor.new("Bright blue")
Bullet.Anchored=true
Bullet.CanCollide=false
Bullet.Locked=true
Bullet.Size=Vector3.new(1,1,1) |
-- ROBLOX deviation: we don't escape any characters since multiline literals don't
-- consume escape sequences |
local function escapeBacktickString(str: string): string
return str
end
|
-- ROBLOX deviation END |
exports.default = function(snapshot: Snapshot, afterUpdate: boolean): Array<string>
local statuses = {}
if Boolean.toJSBoolean(snapshot.added) then
table.insert(statuses, SNAPSHOT_ADDED(ARROW .. pluralize("snapshot", snapshot.added) .. " written."))
end
if Boolean.toJSBoolean(snapshot.updated) then
table.insert(statuses, SNAPSHOT_UPDATED(ARROW .. pluralize("snapshot", snapshot.updated) .. " updated."))
end
if Boolean.toJSBoolean(snapshot.unmatched) then
table.insert(statuses, FAIL_COLOR(ARROW .. pluralize("snapshot", snapshot.unmatched) .. " failed."))
end
if Boolean.toJSBoolean(snapshot.unchecked) then
if afterUpdate then
table.insert(statuses, SNAPSHOT_UPDATED(ARROW .. pluralize("snapshot", snapshot.unchecked) .. " removed."))
else
table.insert(
statuses,
SNAPSHOT_OUTDATED(ARROW .. pluralize("snapshot", snapshot.unchecked) .. " obsolete.")
)
end
Array.forEach(snapshot.uncheckedKeys, function(key: string)
table.insert(statuses, " " .. DOT .. key)
end)
end
if snapshot.fileDeleted then
table.insert(statuses, SNAPSHOT_UPDATED(ARROW .. "snapshot file removed."))
end
return statuses
end
return exports
|
--[[Engine]] |
--Torque Curve
Tune.Horsepower = 900 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 6000 -- Use sliders to manipulate values
Tune.Redline = 8000 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 4500
Tune.PeakSharpness = 2.8
Tune.CurveMult = 0.2
--Incline Compensation
Tune.InclineComp = 2 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 150 -- RPM acceleration when clutch is off
Tune.RevDecay = 100 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = .01 -- Percent throttle at idle
Tune.ClutchTol = 300 -- Clutch engagement threshold (higher = faster response)
|
--- Add a line to the command bar |
function Window:AddLine(text, color)
text = tostring(text)
if #text == 0 then
Window:UpdateWindowHeight()
return
end
local str = self.Cmdr.Util.EmulateTabstops(text or "nil", 8)
local line = Line:Clone()
line.Size =
UDim2.new(
line.Size.X.Scale,
line.Size.X.Offset,
0,
TextService:GetTextSize(
str,
line.TextSize,
line.Font,
Vector2.new(Gui.UIListLayout.AbsoluteContentSize.X, math.huge)
).Y + (LINE_HEIGHT - line.TextSize)
)
line.Text = str
line.TextColor3 = color or line.TextColor3
line.Parent = Gui
end
|
--[[Weight and CG]] |
Tune.Weight = 3001 -- Total weight (in pounds)
Tune.WeightBSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable)
--[[Width]] 6 ,
--[[Height]] 3.5 ,
--[[Length]] 15 }
Tune.WeightDist = 50 -- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100)
Tune.CGHeight = .8 -- Center of gravity height (studs relative to median of all wheels)
Tune.WBVisible = false -- Makes the weight brick visible
--Unsprung Weight
Tune.FWheelDensity = .1 -- Front Wheel Density
Tune.RWheelDensity = .1 -- Rear Wheel Density
Tune.FWLgcyDensity = 1 -- Front Wheel Density [PGS OFF]
Tune.RWLgcyDensity = 1 -- Rear Wheel Density [PGS OFF]
Tune.AxleSize = 2.17 -- Size of structural members (larger = more stable/carry more weight)
Tune.AxleDensity = .1 -- Density of structural members
|
-- Decompiled with the Synapse X Luau decompiler. |
local v1 = {};
local l__UserInputService__2 = game:GetService("UserInputService");
local l__RunService__3 = game:GetService("RunService");
local l__Players__4 = game:GetService("Players");
local l__TextService__5 = game:GetService("TextService");
local v6 = l__Players__4.LocalPlayer;
while not v6 do
l__Players__4.PlayerAdded:wait();
v6 = l__Players__4.LocalPlayer;
end;
local l__Chat__7 = game:GetService("Chat");
local l__Parent__8 = script.Parent;
local v9 = require(l__Chat__7:WaitForChild("ClientChatModules"):WaitForChild("ChatSettings"));
local v10 = require(l__Parent__8:WaitForChild("CurveUtil"));
local v11 = require(l__Parent__8:WaitForChild("MessageSender"));
local u1 = nil;
pcall(function()
u1 = require(game:GetService("Chat").ClientChatModules.ChatLocalization);
end);
if u1 == nil then
u1 = {
Get = function(p1, p2, p3)
return p3;
end
};
end;
local v12 = {};
v12.__index = v12;
function v12.CreateGuiObjects(p4, p5)
p4.ChatBarParentFrame = p5;
local v13 = Instance.new("Frame");
v13.Selectable = false;
v13.Size = UDim2.new(1, 0, 1, 0);
v13.BackgroundTransparency = 0.6;
v13.BorderSizePixel = 0;
v13.BackgroundColor3 = v9.ChatBarBackGroundColor;
v13.Parent = p5;
local v14 = Instance.new("Frame");
v14.Selectable = false;
v14.Name = "BoxFrame";
v14.BackgroundTransparency = 0.6;
v14.BorderSizePixel = 0;
v14.BackgroundColor3 = v9.ChatBarBoxColor;
v14.Size = UDim2.new(1, -14, 1, -14);
v14.Position = UDim2.new(0, 7, 0, 7);
v14.Parent = v13;
local v15 = Instance.new("Frame");
v15.BackgroundTransparency = 1;
v15.Size = UDim2.new(1, -10, 1, -10);
v15.Position = UDim2.new(0, 5, 0, 5);
v15.Parent = v14;
local v16 = Instance.new("TextBox");
v16.Selectable = v9.GamepadNavigationEnabled;
v16.Name = "ChatBar";
v16.BackgroundTransparency = 1;
v16.Size = UDim2.new(1, 0, 1, 0);
v16.Position = UDim2.new(0, 0, 0, 0);
v16.TextSize = v9.ChatBarTextSize;
v16.Font = v9.ChatBarFont;
v16.TextColor3 = v9.ChatBarTextColor;
v16.TextTransparency = 0.4;
v16.TextStrokeTransparency = 1;
v16.ClearTextOnFocus = false;
v16.TextXAlignment = Enum.TextXAlignment.Left;
v16.TextYAlignment = Enum.TextYAlignment.Top;
v16.TextWrapped = true;
v16.Text = "";
v16.Parent = v15;
local v17 = Instance.new("TextButton");
v17.Selectable = false;
v17.Name = "MessageMode";
v17.BackgroundTransparency = 1;
v17.Position = UDim2.new(0, 0, 0, 0);
v17.TextSize = v9.ChatBarTextSize;
v17.Font = v9.ChatBarFont;
v17.TextXAlignment = Enum.TextXAlignment.Left;
v17.TextWrapped = true;
v17.Text = "";
v17.Size = UDim2.new(0, 0, 0, 0);
v17.TextYAlignment = Enum.TextYAlignment.Center;
v17.TextColor3 = p4:GetDefaultChannelNameColor();
v17.Visible = true;
v17.Parent = v15;
local v18 = Instance.new("TextLabel");
v18.Selectable = false;
v18.TextWrapped = true;
v18.BackgroundTransparency = 1;
v18.Size = v16.Size;
v18.Position = v16.Position;
v18.TextSize = v16.TextSize;
v18.Font = v16.Font;
v18.TextColor3 = v16.TextColor3;
v18.TextTransparency = v16.TextTransparency;
v18.TextStrokeTransparency = v16.TextStrokeTransparency;
v18.TextXAlignment = v16.TextXAlignment;
v18.TextYAlignment = v16.TextYAlignment;
v18.Text = "...";
v18.Parent = v15;
p4.GuiObject = v13;
p4.TextBox = v16;
p4.TextLabel = v18;
p4.GuiObjects.BaseFrame = v13;
p4.GuiObjects.TextBoxFrame = v14;
p4.GuiObjects.TextBox = v16;
p4.GuiObjects.TextLabel = v18;
p4.GuiObjects.MessageModeTextButton = v17;
p4:AnimGuiObjects();
p4:SetUpTextBoxEvents(v16, v18, v17);
if p4.UserHasChatOff then
p4:DoLockChatBar();
end;
p4.eGuiObjectsChanged:Fire();
end;
function v12.DoLockChatBar(p6)
if p6.TextLabel then
if v6.UserId > 0 then
p6.TextLabel.Text = u1:Get("GameChat_ChatMessageValidator_SettingsError", "To chat in game, turn on chat in your Privacy Settings.");
else
p6.TextLabel.Text = u1:Get("GameChat_SwallowGuestChat_Message", "Sign up to chat in game.");
end;
p6:CalculateSize();
end;
if p6.TextBox then
p6.TextBox.Active = false;
p6.TextBox.Focused:connect(function()
p6.TextBox:ReleaseFocus();
end);
end;
end;
function v12.SetUpTextBoxEvents(p7, p8, p9, p10)
for v19, v20 in pairs(p7.TextBoxConnections) do
v20:disconnect();
p7.TextBoxConnections[v19] = nil;
end;
p7.TextBoxConnections.UserInputBegan = l__UserInputService__2.InputBegan:connect(function(p11, p12)
if p11.KeyCode == Enum.KeyCode.Backspace and p7:IsFocused() and p8.Text == "" then
p7:SetChannelTarget(v9.GeneralChannelName);
end;
end);
p7.TextBoxConnections.TextBoxChanged = p8.Changed:connect(function(p13)
local v21 = nil;
if p13 == "AbsoluteSize" then
p7:CalculateSize();
return;
end;
if p13 ~= "Text" then
return;
end;
p7:CalculateSize();
if v9.MaximumMessageLength < string.len(p8.Text) then
p8.Text = string.sub(p8.Text, 1, v9.MaximumMessageLength);
return;
end;
if not p7.InCustomState then
v21 = p7.CommandProcessor:ProcessInProgressChatMessage(p8.Text, p7.ChatWindow, p7);
if not v21 then
return;
end;
else
p7.CustomState:TextUpdated();
return;
end;
p7.InCustomState = true;
p7.CustomState = v21;
end);
p7.TextBoxConnections.MessageModeClick = p10.MouseButton1Click:connect(function()
if p10.Text ~= "" then
p7:SetChannelTarget(v9.GeneralChannelName);
end;
end);
p7.TextBoxConnections.TextBoxFocused = p8.Focused:connect(function()
if not p7.UserHasChatOff then
p7:CalculateSize();
p9.Visible = false;
end;
end);
p7.TextBoxConnections.TextBoxFocusLost = p8.FocusLost:connect(function(p14, p15)
p7:CalculateSize();
if p15 and p15.KeyCode == Enum.KeyCode.Escape then
p8.Text = "";
end;
if p8.Text ~= "" then
p9.Visible = false;
return;
end;
p9.Visible = true;
end);
end;
function v12.GetTextBox(p16)
return p16.TextBox;
end;
function v12.GetMessageModeTextButton(p17)
return p17.GuiObjects.MessageModeTextButton;
end;
function v12.GetMessageModeTextLabel(p18)
return p18:GetMessageModeTextButton();
end;
function v12.IsFocused(p19)
if p19.UserHasChatOff then
return false;
end;
return p19:GetTextBox():IsFocused();
end;
function v12.GetVisible(p20)
return p20.GuiObject.Visible;
end;
function v12.CaptureFocus(p21)
if not p21.UserHasChatOff then
p21:GetTextBox():CaptureFocus();
end;
end;
function v12.ReleaseFocus(p22, p23)
p22:GetTextBox():ReleaseFocus(p23);
end;
function v12.ResetText(p24)
p24:GetTextBox().Text = "";
end;
function v12.SetText(p25, p26)
p25:GetTextBox().Text = p26;
end;
function v12.GetEnabled(p27)
return p27.GuiObject.Visible;
end;
function v12.SetEnabled(p28, p29)
if p28.UserHasChatOff then
p28.GuiObject.Visible = true;
return;
end;
p28.GuiObject.Visible = p29;
end;
function v12.SetTextLabelText(p30, p31)
if not p30.UserHasChatOff then
p30.TextLabel.Text = p31;
end;
end;
function v12.SetTextBoxText(p32, p33)
p32.TextBox.Text = p33;
end;
function v12.GetTextBoxText(p34)
return p34.TextBox.Text;
end;
function v12.ResetSize(p35)
p35.TargetYSize = 0;
p35:TweenToTargetYSize();
end;
function v12.CalculateSize(p36)
if p36.CalculatingSizeLock then
return;
end;
p36.CalculatingSizeLock = true;
if p36:IsFocused() or p36.TextBox.Text ~= "" then
local v22 = p36.TextBox.TextSize;
local l__TextBox__23 = p36.TextBox;
local v24 = l__TextService__5:GetTextSize(l__TextBox__23.Text, l__TextBox__23.TextSize, l__TextBox__23.Font, Vector2.new(l__TextBox__23.AbsoluteSize.X, 10000)).Y;
else
v22 = p36.TextLabel.TextSize;
local l__TextLabel__25 = p36.TextLabel;
v24 = l__TextService__5:GetTextSize(l__TextLabel__25.Text, l__TextLabel__25.TextSize, l__TextLabel__25.Font, Vector2.new(l__TextLabel__25.AbsoluteSize.X, 10000)).Y;
end;
local v26 = v24 - v22;
if p36.TargetYSize ~= v26 then
p36.TargetYSize = v26;
p36:TweenToTargetYSize();
end;
p36.CalculatingSizeLock = false;
end;
function v12.TweenToTargetYSize(p37)
local v27 = UDim2.new(1, 0, 1, p37.TargetYSize);
p37.GuiObject.Size = v27;
p37.GuiObject.Size = p37.GuiObject.Size;
local u2 = math.min(1, math.abs(p37.GuiObject.AbsoluteSize.Y - p37.GuiObject.AbsoluteSize.Y) * (1 / p37.TweenPixelsPerSecond));
if not pcall(function()
p37.GuiObject:TweenSize(v27, Enum.EasingDirection.Out, Enum.EasingStyle.Quad, u2, true);
end) then
p37.GuiObject.Size = v27;
end;
end;
function v12.SetTextSize(p38, p39)
if not p38:IsInCustomState() then
if p38.TextBox then
p38.TextBox.TextSize = p39;
end;
if p38.TextLabel then
p38.TextLabel.TextSize = p39;
end;
end;
end;
function v12.GetDefaultChannelNameColor(p40)
if not v9.DefaultChannelNameColor then
return Color3.fromRGB(35, 76, 142);
end;
return v9.DefaultChannelNameColor;
end;
function v12.SetChannelTarget(p41, p42)
local l__MessageModeTextButton__28 = p41.GuiObjects.MessageModeTextButton;
local l__TextBox__29 = p41.TextBox;
local l__TextLabel__30 = p41.TextLabel;
p41.TargetChannel = p42;
if not p41:IsInCustomState() then
if p42 == v9.GeneralChannelName then
l__MessageModeTextButton__28.Text = "";
l__MessageModeTextButton__28.Size = UDim2.new(0, 0, 0, 0);
l__TextBox__29.Size = UDim2.new(1, 0, 1, 0);
l__TextBox__29.Position = UDim2.new(0, 0, 0, 0);
l__TextLabel__30.Size = UDim2.new(1, 0, 1, 0);
l__TextLabel__30.Position = UDim2.new(0, 0, 0, 0);
return;
end;
else
return;
end;
l__MessageModeTextButton__28.Size = UDim2.new(0, 1000, 1, 0);
l__MessageModeTextButton__28.Text = string.format("[%s] ", p42);
local v31 = p41:GetChannelNameColor(p42);
if v31 then
l__MessageModeTextButton__28.TextColor3 = v31;
else
l__MessageModeTextButton__28.TextColor3 = p41:GetDefaultChannelNameColor();
end;
local l__X__32 = l__MessageModeTextButton__28.TextBounds.X;
l__MessageModeTextButton__28.Size = UDim2.new(0, l__X__32, 1, 0);
l__TextBox__29.Size = UDim2.new(1, -l__X__32, 1, 0);
l__TextBox__29.Position = UDim2.new(0, l__X__32, 0, 0);
l__TextLabel__30.Size = UDim2.new(1, -l__X__32, 1, 0);
l__TextLabel__30.Position = UDim2.new(0, l__X__32, 0, 0);
end;
function v12.IsInCustomState(p43)
return p43.InCustomState;
end;
function v12.ResetCustomState(p44)
if p44.InCustomState then
p44.CustomState:Destroy();
p44.CustomState = nil;
p44.InCustomState = false;
p44.ChatBarParentFrame:ClearAllChildren();
p44:CreateGuiObjects(p44.ChatBarParentFrame);
p44:SetTextLabelText(u1:Get("GameChat_ChatMain_ChatBarText", "To chat click here or press \"/\" key"));
end;
end;
function v12.GetCustomMessage(p45)
if not p45.InCustomState then
return nil;
end;
return p45.CustomState:GetMessage();
end;
function v12.CustomStateProcessCompletedMessage(p46, p47)
if not p46.InCustomState then
return false;
end;
return p46.CustomState:ProcessCompletedMessage();
end;
function v12.FadeOutBackground(p48, p49)
p48.AnimParams.Background_TargetTransparency = 1;
p48.AnimParams.Background_NormalizedExptValue = v10:NormalizedDefaultExptValueInSeconds(p49);
p48:FadeOutText(p49);
end;
function v12.FadeInBackground(p50, p51)
p50.AnimParams.Background_TargetTransparency = 0.6;
p50.AnimParams.Background_NormalizedExptValue = v10:NormalizedDefaultExptValueInSeconds(p51);
p50:FadeInText(p51);
end;
function v12.FadeOutText(p52, p53)
p52.AnimParams.Text_TargetTransparency = 1;
p52.AnimParams.Text_NormalizedExptValue = v10:NormalizedDefaultExptValueInSeconds(p53);
end;
function v12.FadeInText(p54, p55)
p54.AnimParams.Text_TargetTransparency = 0.4;
p54.AnimParams.Text_NormalizedExptValue = v10:NormalizedDefaultExptValueInSeconds(p55);
end;
function v12.AnimGuiObjects(p56)
p56.GuiObject.BackgroundTransparency = p56.AnimParams.Background_CurrentTransparency;
p56.GuiObjects.TextBoxFrame.BackgroundTransparency = p56.AnimParams.Background_CurrentTransparency;
p56.GuiObjects.TextLabel.TextTransparency = p56.AnimParams.Text_CurrentTransparency;
p56.GuiObjects.TextBox.TextTransparency = p56.AnimParams.Text_CurrentTransparency;
p56.GuiObjects.MessageModeTextButton.TextTransparency = p56.AnimParams.Text_CurrentTransparency;
end;
function v12.InitializeAnimParams(p57)
p57.AnimParams.Text_TargetTransparency = 0.4;
p57.AnimParams.Text_CurrentTransparency = 0.4;
p57.AnimParams.Text_NormalizedExptValue = 1;
p57.AnimParams.Background_TargetTransparency = 0.6;
p57.AnimParams.Background_CurrentTransparency = 0.6;
p57.AnimParams.Background_NormalizedExptValue = 1;
end;
function v12.Update(p58, p59)
p58.AnimParams.Text_CurrentTransparency = v10:Expt(p58.AnimParams.Text_CurrentTransparency, p58.AnimParams.Text_TargetTransparency, p58.AnimParams.Text_NormalizedExptValue, p59);
p58.AnimParams.Background_CurrentTransparency = v10:Expt(p58.AnimParams.Background_CurrentTransparency, p58.AnimParams.Background_TargetTransparency, p58.AnimParams.Background_NormalizedExptValue, p59);
p58:AnimGuiObjects();
end;
function v12.SetChannelNameColor(p60, p61, p62)
p60.ChannelNameColors[p61] = p62;
if p60.GuiObjects.MessageModeTextButton.Text == p61 then
p60.GuiObjects.MessageModeTextButton.TextColor3 = p62;
end;
end;
function v12.GetChannelNameColor(p63, p64)
return p63.ChannelNameColors[p64];
end;
function v1.new(p65, p66)
local v33 = setmetatable({}, v12);
v33.GuiObject = nil;
v33.ChatBarParentFrame = nil;
v33.TextBox = nil;
v33.TextLabel = nil;
v33.GuiObjects = {};
v33.eGuiObjectsChanged = Instance.new("BindableEvent");
v33.GuiObjectsChanged = v33.eGuiObjectsChanged.Event;
v33.TextBoxConnections = {};
v33.InCustomState = false;
v33.CustomState = nil;
v33.TargetChannel = nil;
v33.CommandProcessor = p65;
v33.ChatWindow = p66;
v33.TweenPixelsPerSecond = 500;
v33.TargetYSize = 0;
v33.AnimParams = {};
v33.CalculatingSizeLock = false;
v33.ChannelNameColors = {};
v33.UserHasChatOff = false;
v33:InitializeAnimParams();
v9.SettingsChanged:connect(function(p67, p68)
if p67 == "ChatBarTextSize" then
v33:SetTextSize(p68);
end;
end);
coroutine.wrap(function()
local v34, v35 = pcall(function()
return l__Chat__7:CanUserChatAsync(v6.UserId);
end);
if (v34 and (l__RunService__3:IsStudio() and v35)) == false then
v33.UserHasChatOff = true;
v33:DoLockChatBar();
end;
end)();
return v33;
end;
return v1;
|
-- ================================================================================
-- PUBLIC FUNCTIONS
-- ================================================================================ |
function Engine.new(speeder)
local newEngine = {}
setmetatable(newEngine, Engine)
newEngine.Speeder = speeder
newEngine.Main = speeder.main
newEngine.Mass = speeder.mass
-- Attachment
local attachment = Instance.new("Attachment")
attachment.Parent = speeder.main
-- Thruster (foward/backward)
newEngine.Thruster = Instance.new("BodyVelocity")
newEngine.Thruster.Name = "Thruster"
newEngine.Thruster.Parent = speeder.main
-- Gyro (steering)
newEngine.Steering = Instance.new("BodyGyro")
newEngine.Steering.Name = "Steering"
newEngine.Steering.Parent = speeder.main
newEngine._settings = speeder._settings
-- Set settings
newEngine._SPEED = newEngine._settings.DefaultSpeed
newEngine._BOOSTSPEED = newEngine._settings.BoostSpeed
newEngine._PITCH = (3.5*newEngine._settings.Steering)*(math.pi/180)
newEngine._YAW = (-4*newEngine._settings.Steering)*(math.pi/180)
newEngine._ROLL = (2*newEngine._settings.Steering)*(math.pi/180)
EngineRate = IIRFilter(0.005)
StartSound:Play()
local soundConnection
soundConnection = StartSound.Ended:Connect(function()
MotorSound:Play()
soundConnection:Disconnect()
end)
return newEngine
end -- Engine:new()
|
--[ FUNCTION ]- |
function updateMusic()
local id = string.gsub(music.SoundId, "rbxassetid://", "")
local success, info = pcall(mps.GetProductInfo, mps, id)
if success then
Frame:TweenPosition(UDim2.new(0.288, 0, 0.026, 0),"Out","Quad",.5,true) -- changing it to in
script.Parent.Text = "Now Playing : " .. info.Name -- changing name
if requester.Value ~= "" then
label.Text = string.format("Song requested by: %s", requester.Value)
label.Visible = true
else
label.Visible = false
end
wait(5) -- wait to close it
Frame:TweenPosition(UDim2.new(0.288, 0,-1, 0),"In","Quad",.5,true) -- changing it to in
end
end
updateMusic()
music:GetPropertyChangedSignal("SoundId"):Connect(updateMusic)
|
-- Setup gesture area that camera uses while DynamicThumbstick is enabled |
local function OnCharacterAdded(character)
if UserInputService.TouchEnabled then
if PlayerGui then
local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Name = "GestureArea"
ScreenGui.Parent = PlayerGui
GestureArea = Instance.new("Frame")
GestureArea.BackgroundTransparency = 1.0
GestureArea.Visible = true
GestureArea.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
layoutGestureArea(PortraitMode)
GestureArea.Parent = ScreenGui
end
for _, child in ipairs(LocalPlayer.Character:GetChildren()) do
if child:IsA("Tool") then
IsAToolEquipped = true
end
end
character.ChildAdded:Connect(function(child)
if child:IsA("Tool") then
IsAToolEquipped = true
end
end)
character.ChildRemoved:Connect(function(child)
if child:IsA("Tool") then
IsAToolEquipped = false
end
end)
end
end
if LocalPlayer then
if LocalPlayer.Character ~= nil then
OnCharacterAdded(LocalPlayer.Character)
end
LocalPlayer.CharacterAdded:connect(function(character)
OnCharacterAdded(character)
end)
end
local function positionIntersectsGuiObject(position, guiObject)
if position.X < guiObject.AbsolutePosition.X + guiObject.AbsoluteSize.X
and position.X > guiObject.AbsolutePosition.X
and position.Y < guiObject.AbsolutePosition.Y + guiObject.AbsoluteSize.Y
and position.Y > guiObject.AbsolutePosition.Y then
return true
end
return false
end
local function GetRenderCFrame(part)
return part:GetRenderCFrame()
end
local function CreateCamera()
local this = {}
local R15HeadHeight = R15_HEAD_OFFSET
function this:GetActivateValue()
return 0.7
end
function this:IsPortraitMode()
return PortraitMode
end
function this:GetRotateAmountValue(vrRotationIntensity)
vrRotationIntensity = vrRotationIntensity or StarterGui:GetCore("VRRotationIntensity")
if vrRotationIntensity then
if vrRotationIntensity == "Low" then
return VR_LOW_INTENSITY_ROTATION
elseif vrRotationIntensity == "High" then
return VR_HIGH_INTENSITY_ROTATION
end
end
return ZERO_VECTOR2
end
function this:GetRepeatDelayValue(vrRotationIntensity)
vrRotationIntensity = vrRotationIntensity or StarterGui:GetCore("VRRotationIntensity")
if vrRotationIntensity then
if vrRotationIntensity == "Low" then
return VR_LOW_INTENSITY_REPEAT
elseif vrRotationIntensity == "High" then
return VR_HIGH_INTENSITY_REPEAT
end
end
return 0
end
this.ShiftLock = false
this.Enabled = false
local isFirstPerson = false
local isRightMouseDown = false
local isMiddleMouseDown = false
this.RotateInput = ZERO_VECTOR2
this.DefaultZoom = LANDSCAPE_DEFAULT_ZOOM
this.activeGamepad = nil
local tweens = {}
this.lastSubject = nil
this.lastSubjectPosition = Vector3.new(0, 5, 0)
local lastVRRotation = 0
local vrRotateKeyCooldown = {}
local isDynamicThumbstickEnabled = false
-- Check for changes in ViewportSize to decide if PortraitMode
local CameraChangedConn = nil
local workspaceCameraChangedConn = nil
local function onWorkspaceCameraChanged()
if UserInputService.TouchEnabled then
if CameraChangedConn then
CameraChangedConn:Disconnect()
CameraChangedConn = nil
end
local newCamera = workspace.CurrentCamera
if newCamera then
local size = newCamera.ViewportSize
PortraitMode = size.X < size.Y
layoutGestureArea(PortraitMode)
DefaultZoom = PortraitMode and PORTRAIT_DEFAULT_ZOOM or LANDSCAPE_DEFAULT_ZOOM
CameraChangedConn = newCamera:GetPropertyChangedSignal("ViewportSize"):Connect(function()
size = newCamera.ViewportSize
PortraitMode = size.X < size.Y
layoutGestureArea(PortraitMode)
DefaultZoom = PortraitMode and PORTRAIT_DEFAULT_ZOOM or LANDSCAPE_DEFAULT_ZOOM
end)
end
end
end
workspaceCameraChangedConn = workspace:GetPropertyChangedSignal("CurrentCamera"):Connect(onWorkspaceCameraChanged)
if workspace.CurrentCamera then
onWorkspaceCameraChanged()
end
function this:GetShiftLock()
return ShiftLockController:IsShiftLocked()
end
function this:GetHumanoid()
local player = PlayersService.LocalPlayer
return findPlayerHumanoid(player)
end
function this:GetHumanoidRootPart()
local humanoid = this:GetHumanoid()
return humanoid and humanoid.Torso
end
function this:GetRenderCFrame(part)
GetRenderCFrame(part)
end
local STATE_DEAD = Enum.HumanoidStateType.Dead
-- HumanoidRootPart when alive, Head part when dead
local function getHumanoidPartToFollow(humanoid, humanoidStateType)
if humanoidStateType == STATE_DEAD then
local character = humanoid.Parent
if character then
return character:FindFirstChild("Head") or humanoid.Torso
else
return humanoid.Torso
end
else
return humanoid.Torso
end
end
local HUMANOID_STATE_DEAD = Enum.HumanoidStateType.Dead
function this:GetSubjectPosition()
local result = nil
local camera = workspace.CurrentCamera
local cameraSubject = camera and camera.CameraSubject
if cameraSubject then
if cameraSubject:IsA('Humanoid') then
local humanoidStateType = cameraSubject:GetState()
if VRService.VREnabled and humanoidStateType == STATE_DEAD and cameraSubject == this.lastSubject then
result = this.lastSubjectPosition
else
local humanoidRootPart = getHumanoidPartToFollow(cameraSubject, humanoidStateType)
if humanoidRootPart and humanoidRootPart:IsA('BasePart') then
local subjectCFrame = GetRenderCFrame(humanoidRootPart)
local heightOffset = ZERO_VECTOR3
if humanoidStateType ~= STATE_DEAD then
heightOffset = cameraSubject.RigType == Enum.HumanoidRigType.R15 and R15HeadHeight or HEAD_OFFSET
end
result = subjectCFrame.p +
subjectCFrame:vectorToWorldSpace(heightOffset + cameraSubject.CameraOffset)
end
end
elseif cameraSubject:IsA('VehicleSeat') then
local subjectCFrame = GetRenderCFrame(cameraSubject)
local offset = SEAT_OFFSET
if VRService.VREnabled then
offset = VR_SEAT_OFFSET
end
result = subjectCFrame.p + subjectCFrame:vectorToWorldSpace(offset)
elseif cameraSubject:IsA('SkateboardPlatform') then
local subjectCFrame = GetRenderCFrame(cameraSubject)
result = subjectCFrame.p + SEAT_OFFSET
elseif cameraSubject:IsA('BasePart') then
local subjectCFrame = GetRenderCFrame(cameraSubject)
result = subjectCFrame.p
elseif cameraSubject:IsA('Model') then
result = cameraSubject:GetModelCFrame().p
end
end
this.lastSubject = cameraSubject
this.lastSubjectPosition = result
return result
end
function this:ResetCameraLook()
end
function this:GetCameraLook()
return workspace.CurrentCamera and workspace.CurrentCamera.CoordinateFrame.lookVector or Vector3.new(0,0,1)
end
function this:GetCameraZoom()
if this.currentZoom == nil then
local player = PlayersService.LocalPlayer
this.currentZoom = player and clamp(player.CameraMinZoomDistance, player.CameraMaxZoomDistance, this.DefaultZoom) or this.DefaultZoom
end
return this.currentZoom
end
function this:GetCameraActualZoom()
local camera = workspace.CurrentCamera
if camera then
return (camera.CoordinateFrame.p - camera.Focus.p).magnitude
end
end
function this:GetCameraHeight()
if VRService.VREnabled and not this:IsInFirstPerson() then
local zoom = this:GetCameraZoom()
return math.sin(VR_ANGLE) * zoom
end
return 0
end
function this:ViewSizeX()
local result = 1024
local camera = workspace.CurrentCamera
if camera then
result = camera.ViewportSize.X
end
return result
end
function this:ViewSizeY()
local result = 768
local camera = workspace.CurrentCamera
if camera then
result = camera.ViewportSize.Y
end
return result
end
local math_asin = math.asin
local math_atan2 = math.atan2
local math_floor = math.floor
local math_max = math.max
local math_pi = math.pi
local Vector2_new = Vector2.new
local Vector3_new = Vector3.new
local CFrame_Angles = CFrame.Angles
local CFrame_new = CFrame.new
function this:ScreenTranslationToAngle(translationVector)
local screenX = this:ViewSizeX()
local screenY = this:ViewSizeY()
local xTheta = (translationVector.x / screenX)
local yTheta = (translationVector.y / screenY)
return Vector2_new(xTheta, yTheta)
end
function this:MouseTranslationToAngle(translationVector)
local xTheta = (translationVector.x / 1920)
local yTheta = (translationVector.y / 1200)
return Vector2_new(xTheta, yTheta)
end
function this:RotateVector(startVector, xyRotateVector)
local startCFrame = CFrame_new(ZERO_VECTOR3, startVector)
local resultLookVector = (CFrame_Angles(0, -xyRotateVector.x, 0) * startCFrame * CFrame_Angles(-xyRotateVector.y,0,0)).lookVector
return resultLookVector, Vector2_new(xyRotateVector.x, xyRotateVector.y)
end
function this:RotateCamera(startLook, xyRotateVector)
if VRService.VREnabled then
local yawRotatedVector, xyRotateVector = self:RotateVector(startLook, Vector2.new(xyRotateVector.x, 0))
return Vector3_new(yawRotatedVector.x, 0, yawRotatedVector.z).unit, xyRotateVector
else
local startVertical = math_asin(startLook.y)
local yTheta = clamp(-MAX_Y + startVertical, -MIN_Y + startVertical, xyRotateVector.y)
return self:RotateVector(startLook, Vector2_new(xyRotateVector.x, yTheta))
end
end
function this:IsInFirstPerson()
return isFirstPerson
end
-- there are several cases to consider based on the state of input and camera rotation mode
function this:UpdateMouseBehavior()
-- first time transition to first person mode or shiftlock
if isFirstPerson or self:GetShiftLock() then
pcall(function() GameSettings.RotationType = Enum.RotationType.CameraRelative end)
if UserInputService.MouseBehavior ~= Enum.MouseBehavior.LockCenter then
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
end
else
pcall(function() GameSettings.RotationType = Enum.RotationType.MovementRelative end)
if isRightMouseDown or isMiddleMouseDown then
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCurrentPosition
else
UserInputService.MouseBehavior = Enum.MouseBehavior.Default
end
end
end
function this:ZoomCamera(desiredZoom)
local player = PlayersService.LocalPlayer
if player then
if player.CameraMode == Enum.CameraMode.LockFirstPerson then
this.currentZoom = 0
else
this.currentZoom = clamp(player.CameraMinZoomDistance, player.CameraMaxZoomDistance, desiredZoom)
end
end
isFirstPerson = self:GetCameraZoom() < 2
ShiftLockController:SetIsInFirstPerson(isFirstPerson)
-- set mouse behavior
self:UpdateMouseBehavior()
return self:GetCameraZoom()
end
function this:rk4Integrator(position, velocity, t)
local direction = velocity < 0 and -1 or 1
local function acceleration(p, v)
local accel = direction * math_max(1, (p / 3.3) + 0.5)
return accel
end
local p1 = position
local v1 = velocity
local a1 = acceleration(p1, v1)
local p2 = p1 + v1 * (t / 2)
local v2 = v1 + a1 * (t / 2)
local a2 = acceleration(p2, v2)
local p3 = p1 + v2 * (t / 2)
local v3 = v1 + a2 * (t / 2)
local a3 = acceleration(p3, v3)
local p4 = p1 + v3 * t
local v4 = v1 + a3 * t
local a4 = acceleration(p4, v4)
local positionResult = position + (v1 + 2 * v2 + 2 * v3 + v4) * (t / 6)
local velocityResult = velocity + (a1 + 2 * a2 + 2 * a3 + a4) * (t / 6)
return positionResult, velocityResult
end
function this:ZoomCameraBy(zoomScale)
local zoom = this:GetCameraActualZoom()
if zoom then
-- Can break into more steps to get more accurate integration
zoom = self:rk4Integrator(zoom, zoomScale, 1)
self:ZoomCamera(zoom)
end
return self:GetCameraZoom()
end
function this:ZoomCameraFixedBy(zoomIncrement)
return self:ZoomCamera(self:GetCameraZoom() + zoomIncrement)
end
function this:Update()
end
----- VR STUFF ------
function this:ApplyVRTransform()
if not VRService.VREnabled then
return
end
--we only want this to happen in first person VR
local player = PlayersService.LocalPlayer
if not (player and player.Character
and player.Character:FindFirstChild("HumanoidRootPart")
and player.Character.HumanoidRootPart:FindFirstChild("RootJoint")) then
return
end
local camera = workspace.CurrentCamera
local cameraSubject = camera.CameraSubject
local isInVehicle = cameraSubject and cameraSubject:IsA('VehicleSeat')
if this:IsInFirstPerson() and not isInVehicle then
local vrFrame = VRService:GetUserCFrame(Enum.UserCFrame.Head)
local vrRotation = vrFrame - vrFrame.p
local rootJoint = player.Character.HumanoidRootPart.RootJoint
rootJoint.C0 = CFrame.new(vrRotation:vectorToObjectSpace(vrFrame.p)) * CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0)
else
local rootJoint = player.Character.HumanoidRootPart.RootJoint
rootJoint.C0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0)
end
end
local vrRotationIntensityExists = true
local lastVrRotationCheck = 0
function this:ShouldUseVRRotation()
if not VRService.VREnabled then
return false
end
if not vrRotationIntensityExists and tick() - lastVrRotationCheck < 1 then return false end
local success, vrRotationIntensity = pcall(function() return StarterGui:GetCore("VRRotationIntensity") end)
vrRotationIntensityExists = success and vrRotationIntensity ~= nil
lastVrRotationCheck = tick()
return success and vrRotationIntensity ~= nil and vrRotationIntensity ~= "Smooth"
end
function this:GetVRRotationInput()
local vrRotateSum = ZERO_VECTOR2
local vrRotationIntensity = StarterGui:GetCore("VRRotationIntensity")
local vrGamepadRotation = self.GamepadPanningCamera or ZERO_VECTOR2
local delayExpired = (tick() - lastVRRotation) >= self:GetRepeatDelayValue(vrRotationIntensity)
if math.abs(vrGamepadRotation.x) >= self:GetActivateValue() then
if (delayExpired or not vrRotateKeyCooldown[Enum.KeyCode.Thumbstick2]) then
local sign = 1
if vrGamepadRotation.x < 0 then
sign = -1
end
vrRotateSum = vrRotateSum + self:GetRotateAmountValue(vrRotationIntensity) * sign
vrRotateKeyCooldown[Enum.KeyCode.Thumbstick2] = true
end
elseif math.abs(vrGamepadRotation.x) < self:GetActivateValue() - 0.1 then
vrRotateKeyCooldown[Enum.KeyCode.Thumbstick2] = nil
end
if self.TurningLeft then
if delayExpired or not vrRotateKeyCooldown[Enum.KeyCode.Left] then
vrRotateSum = vrRotateSum - self:GetRotateAmountValue(vrRotationIntensity)
vrRotateKeyCooldown[Enum.KeyCode.Left] = true
end
else
vrRotateKeyCooldown[Enum.KeyCode.Left] = nil
end
if self.TurningRight then
if (delayExpired or not vrRotateKeyCooldown[Enum.KeyCode.Right]) then
vrRotateSum = vrRotateSum + self:GetRotateAmountValue(vrRotationIntensity)
vrRotateKeyCooldown[Enum.KeyCode.Right] = true
end
else
vrRotateKeyCooldown[Enum.KeyCode.Right] = nil
end
if vrRotateSum ~= ZERO_VECTOR2 then
lastVRRotation = tick()
end
return vrRotateSum
end
local cameraTranslationConstraints = Vector3.new(1, 1, 1)
local humanoidJumpOrigin = nil
local trackingHumanoid = nil
local cameraFrozen = false
local subjectStateChangedConn = nil
local cameraSubjectChangedConn = nil
local workspaceChangedConn = nil
local humanoidChildAddedConn = nil
local humanoidChildRemovedConn = nil
local function cancelCameraFreeze(keepConstraints)
if not keepConstraints then
cameraTranslationConstraints = Vector3.new(cameraTranslationConstraints.x, 1, cameraTranslationConstraints.z)
end
if cameraFrozen then
trackingHumanoid = nil
cameraFrozen = false
end
end
local function startCameraFreeze(subjectPosition, humanoidToTrack)
if not cameraFrozen then
humanoidJumpOrigin = subjectPosition
trackingHumanoid = humanoidToTrack
cameraTranslationConstraints = Vector3.new(cameraTranslationConstraints.x, 0, cameraTranslationConstraints.z)
cameraFrozen = true
end
end
local function rescaleCameraOffset(newScaleFactor)
R15HeadHeight = R15_HEAD_OFFSET*newScaleFactor
end
local function onHumanoidSubjectChildAdded(child)
if child.Name == "BodyHeightScale" and child:IsA("NumberValue") then
if heightScaleChangedConn then
heightScaleChangedConn:disconnect()
end
heightScaleChangedConn = child.Changed:connect(rescaleCameraOffset)
rescaleCameraOffset(child.Value)
end
end
local function onHumanoidSubjectChildRemoved(child)
if child.Name == "BodyHeightScale" then
rescaleCameraOffset(1)
if heightScaleChangedConn then
heightScaleChangedConn:disconnect()
heightScaleChangedConn = nil
end
end
end
local function onNewCameraSubject()
if subjectStateChangedConn then
subjectStateChangedConn:disconnect()
subjectStateChangedConn = nil
end
if humanoidChildAddedConn then
humanoidChildAddedConn:disconnect()
humanoidChildAddedConn = nil
end
if humanoidChildRemovedConn then
humanoidChildRemovedConn:disconnect()
humanoidChildRemovedConn = nil
end
if heightScaleChangedConn then
heightScaleChangedConn:disconnect()
heightScaleChangedConn = nil
end
local humanoid = workspace.CurrentCamera and workspace.CurrentCamera.CameraSubject
if trackingHumanoid ~= humanoid then
cancelCameraFreeze()
end
if humanoid and humanoid:IsA('Humanoid') then
humanoidChildAddedConn = humanoid.ChildAdded:connect(onHumanoidSubjectChildAdded)
humanoidChildRemovedConn = humanoid.ChildRemoved:connect(onHumanoidSubjectChildRemoved)
for _, child in pairs(humanoid:GetChildren()) do
onHumanoidSubjectChildAdded(child)
end
subjectStateChangedConn = humanoid.StateChanged:connect(function(oldState, newState)
if VRService.VREnabled and newState == Enum.HumanoidStateType.Jumping and not this:IsInFirstPerson() then
startCameraFreeze(this:GetSubjectPosition(), humanoid)
elseif newState ~= Enum.HumanoidStateType.Jumping and newState ~= Enum.HumanoidStateType.Freefall then
cancelCameraFreeze(true)
end
end)
end
end
local function onCurrentCameraChanged()
if cameraSubjectChangedConn then
cameraSubjectChangedConn:disconnect()
cameraSubjectChangedConn = nil
end
local camera = workspace.CurrentCamera
if camera then
cameraSubjectChangedConn = camera:GetPropertyChangedSignal("CameraSubject"):connect(onNewCameraSubject)
onNewCameraSubject()
end
end
function this:GetVRFocus(subjectPosition, timeDelta)
local newFocus = nil
local camera = workspace.CurrentCamera
local lastFocus = self.LastCameraFocus or subjectPosition
if not cameraFrozen then
cameraTranslationConstraints = Vector3.new(cameraTranslationConstraints.x, math.min(1, cameraTranslationConstraints.y + 0.42 * timeDelta), cameraTranslationConstraints.z)
end
if cameraFrozen and humanoidJumpOrigin and humanoidJumpOrigin.y > lastFocus.y then
newFocus = CFrame.new(Vector3.new(subjectPosition.x, math.min(humanoidJumpOrigin.y, lastFocus.y + 5 * timeDelta), subjectPosition.z))
else
newFocus = CFrame.new(Vector3.new(subjectPosition.x, lastFocus.y, subjectPosition.z):lerp(subjectPosition, cameraTranslationConstraints.y))
end
if cameraFrozen then
-- No longer in 3rd person
if self:IsInFirstPerson() then -- not VRService.VREnabled
cancelCameraFreeze()
end
-- This case you jumped off a cliff and want to keep your character in view
-- 0.5 is to fix floating point error when not jumping off cliffs
if humanoidJumpOrigin and subjectPosition.y < (humanoidJumpOrigin.y - 0.5) then
cancelCameraFreeze()
end
end
return newFocus
end
------------------------
---- Input Events ----
local startPos = nil
local lastPos = nil
local panBeginLook = nil
local lastTapTime = nil
local fingerTouches = {}
local NumUnsunkTouches = 0
local inputStartPositions = {}
local inputStartTimes = {}
local StartingDiff = nil
local pinchBeginZoom = nil
this.ZoomEnabled = true
this.PanEnabled = true
this.KeyPanEnabled = true
local function OnTouchBegan(input, processed)
--If isDynamicThumbstickEnabled, then only process TouchBegan event if it starts in GestureArea
if (not touchWorkspaceEventEnabled and not isDynamicThumbstickEnabled) or positionIntersectsGuiObject(input.Position, GestureArea) then
fingerTouches[input] = processed
if not processed then
inputStartPositions[input] = input.Position
inputStartTimes[input] = tick()
NumUnsunkTouches = NumUnsunkTouches + 1
end
end
end
local function OnTouchChanged(input, processed)
if fingerTouches[input] == nil then
if isDynamicThumbstickEnabled then
return
end
fingerTouches[input] = processed
if not processed then
NumUnsunkTouches = NumUnsunkTouches + 1
end
end
if NumUnsunkTouches == 1 then
if fingerTouches[input] == false then
panBeginLook = panBeginLook or this:GetCameraLook()
startPos = startPos or input.Position
lastPos = lastPos or startPos
this.UserPanningTheCamera = true
local delta = input.Position - lastPos
delta = Vector2.new(delta.X, delta.Y * GameSettings:GetCameraYInvertValue())
if this.PanEnabled then
local desiredXYVector = this:ScreenTranslationToAngle(delta) * TOUCH_SENSITIVTY
this.RotateInput = this.RotateInput + desiredXYVector
end
lastPos = input.Position
end
else
panBeginLook = nil
startPos = nil
lastPos = nil
this.UserPanningTheCamera = false
end
if NumUnsunkTouches == 2 then
local unsunkTouches = {}
for touch, wasSunk in pairs(fingerTouches) do
if not wasSunk then
table.insert(unsunkTouches, touch)
end
end
if #unsunkTouches == 2 then
local difference = (unsunkTouches[1].Position - unsunkTouches[2].Position).magnitude
if StartingDiff and pinchBeginZoom then
local scale = difference / math_max(0.01, StartingDiff)
local clampedScale = clamp(0.1, 10, scale)
if this.ZoomEnabled then
this:ZoomCamera(pinchBeginZoom / clampedScale)
end
else
StartingDiff = difference
pinchBeginZoom = this:GetCameraActualZoom()
end
end
else
StartingDiff = nil
pinchBeginZoom = nil
end
end
local function calcLookBehindRotateInput(torso)
if torso then
local newDesiredLook = (torso.CFrame.lookVector - Vector3.new(0,0.23,0)).unit
local horizontalShift = findAngleBetweenXZVectors(newDesiredLook, this:GetCameraLook())
local vertShift = math.asin(this:GetCameraLook().y) - math.asin(newDesiredLook.y)
if not IsFinite(horizontalShift) then
horizontalShift = 0
end
if not IsFinite(vertShift) then
vertShift = 0
end
return Vector2.new(horizontalShift, vertShift)
end
return nil
end
local OnTouchTap = nil
if not touchWorkspaceEventEnabled then
OnTouchTap = function(position)
if isDynamicThumbstickEnabled and not IsAToolEquipped then
if lastTapTime and tick() - lastTapTime < MAX_TIME_FOR_DOUBLE_TAP then
local tween = {
from = this:GetCameraZoom(),
to = DefaultZoom,
start = tick(),
duration = 0.2,
func = function(from, to, alpha)
this:ZoomCamera(from + (to - from)*alpha)
return to
end
}
tweens["Zoom"] = tween
else
local humanoid = this:GetHumanoid()
if humanoid then
local player = PlayersService.LocalPlayer
if player and player.Character then
if humanoid and humanoid.Torso then
local tween = {
from = this.RotateInput,
to = calcLookBehindRotateInput(humanoid.Torso),
start = tick(),
duration = 0.2,
func = function(from, to, alpha)
to = calcLookBehindRotateInput(humanoid.Torso)
if to then
this.RotateInput = from + (to - from)*alpha
end
return to
end
}
tweens["Rotate"] = tween
-- reset old camera info so follow cam doesn't rotate us
this.LastCameraTransform = nil
end
end
end
end
lastTapTime = tick()
end
end
end
local function IsTouchTap(input)
-- We can't make the assumption that the input exists in the inputStartPositions because we may have switched from a different camera type.
if inputStartPositions[input] then
local posDelta = (inputStartPositions[input] - input.Position).magnitude
if posDelta < MAX_TAP_POS_DELTA then
local timeDelta = inputStartTimes[input] - tick()
if timeDelta < MAX_TAP_TIME_DELTA then
return true
end
end
end
return false
end
local function OnTouchEnded(input, processed)
if fingerTouches[input] == false then
if NumUnsunkTouches == 1 then
panBeginLook = nil
startPos = nil
lastPos = nil
this.UserPanningTheCamera = false
if not touchWorkspaceEventEnabled and IsTouchTap(input) then
OnTouchTap(input.Position)
end
elseif NumUnsunkTouches == 2 then
StartingDiff = nil
pinchBeginZoom = nil
end
end
if fingerTouches[input] ~= nil and fingerTouches[input] == false then
NumUnsunkTouches = NumUnsunkTouches - 1
end
fingerTouches[input] = nil
inputStartPositions[input] = nil
inputStartTimes[input] = nil
end
local function OnMousePanButtonPressed(input, processed)
if processed then return end
this:UpdateMouseBehavior()
panBeginLook = panBeginLook or this:GetCameraLook()
startPos = startPos or input.Position
lastPos = lastPos or startPos
this.UserPanningTheCamera = true
end
local function OnMousePanButtonReleased(input, processed)
this:UpdateMouseBehavior()
if not (isRightMouseDown or isMiddleMouseDown) then
panBeginLook = nil
startPos = nil
lastPos = nil
this.UserPanningTheCamera = false
end
end
local function OnMouse2Down(input, processed)
if processed then return end
isRightMouseDown = true
OnMousePanButtonPressed(input, processed)
end
local function OnMouse2Up(input, processed)
isRightMouseDown = false
OnMousePanButtonReleased(input, processed)
end
local function OnMouse3Down(input, processed)
if processed then return end
isMiddleMouseDown = true
OnMousePanButtonPressed(input, processed)
end
local function OnMouse3Up(input, processed)
isMiddleMouseDown = false
OnMousePanButtonReleased(input, processed)
end
local function OnMouseMoved(input, processed)
if not hasGameLoaded and VRService.VREnabled then
return
end
local inputDelta = input.Delta
inputDelta = Vector2.new(inputDelta.X, inputDelta.Y * GameSettings:GetCameraYInvertValue())
if startPos and lastPos and panBeginLook then
local currPos = lastPos + input.Delta
local totalTrans = currPos - startPos
if this.PanEnabled then
local desiredXYVector = this:MouseTranslationToAngle(inputDelta) * MOUSE_SENSITIVITY
this.RotateInput = this.RotateInput + desiredXYVector
end
lastPos = currPos
elseif this:IsInFirstPerson() or this:GetShiftLock() then
if this.PanEnabled then
local desiredXYVector = this:MouseTranslationToAngle(inputDelta) * MOUSE_SENSITIVITY
this.RotateInput = this.RotateInput + desiredXYVector
end
end
end
local function OnMouseWheel(input, processed)
if not hasGameLoaded and VRService.VREnabled then
return
end
if not processed then
if this.ZoomEnabled then
this:ZoomCameraBy(clamp(-1, 1, -input.Position.Z) * 1.4)
end
end
end
local function round(num)
return math_floor(num + 0.5)
end
local eight2Pi = math_pi / 4
local function rotateVectorByAngleAndRound(camLook, rotateAngle, roundAmount)
if camLook ~= ZERO_VECTOR3 then
camLook = camLook.unit
local currAngle = math_atan2(camLook.z, camLook.x)
local newAngle = round((math_atan2(camLook.z, camLook.x) + rotateAngle) / roundAmount) * roundAmount
return newAngle - currAngle
end
return 0
end
local function OnKeyDown(input, processed)
if not hasGameLoaded and VRService.VREnabled then
return
end
if processed then return end
if this.ZoomEnabled then
if input.KeyCode == Enum.KeyCode.I then
-- this:ZoomCameraBy(-5)
elseif input.KeyCode == Enum.KeyCode.O then
-- this:ZoomCameraBy(5)
end
end
if panBeginLook == nil and this.KeyPanEnabled then
if input.KeyCode == Enum.KeyCode.Left then
this.TurningLeft = true
elseif input.KeyCode == Enum.KeyCode.Right then
this.TurningRight = true
elseif input.KeyCode == Enum.KeyCode.Comma then
local angle = rotateVectorByAngleAndRound(this:GetCameraLook() * Vector3.new(1,0,1), -eight2Pi * (3/4), eight2Pi)
if angle ~= 0 then
this.RotateInput = this.RotateInput + Vector2.new(angle, 0)
this.LastUserPanCamera = tick()
this.LastCameraTransform = nil
end
elseif input.KeyCode == Enum.KeyCode.Period then
local angle = rotateVectorByAngleAndRound(this:GetCameraLook() * Vector3.new(1,0,1), eight2Pi * (3/4), eight2Pi)
if angle ~= 0 then
this.RotateInput = this.RotateInput + Vector2.new(angle, 0)
this.LastUserPanCamera = tick()
this.LastCameraTransform = nil
end
elseif input.KeyCode == Enum.KeyCode.PageUp then
--elseif input.KeyCode == Enum.KeyCode.Home then
this.RotateInput = this.RotateInput + Vector2.new(0,math.rad(15))
this.LastCameraTransform = nil
elseif input.KeyCode == Enum.KeyCode.PageDown then
--elseif input.KeyCode == Enum.KeyCode.End then
this.RotateInput = this.RotateInput + Vector2.new(0,math.rad(-15))
this.LastCameraTransform = nil
end
end
end
local function OnKeyUp(input, processed)
if input.KeyCode == Enum.KeyCode.Left then
this.TurningLeft = false
elseif input.KeyCode == Enum.KeyCode.Right then
this.TurningRight = false
end
end
local lastThumbstickRotate = nil
local numOfSeconds = 0.7
local currentSpeed = 0
local maxSpeed = 6
local vrMaxSpeed = 4
local lastThumbstickPos = Vector2.new(0,0)
local ySensitivity = 0.65
local lastVelocity = nil
-- K is a tunable parameter that changes the shape of the S-curve
-- the larger K is the more straight/linear the curve gets
local k = 0.35
local lowerK = 0.8
local function SCurveTranform(t)
t = clamp(-1,1,t)
if t >= 0 then
return (k*t) / (k - t + 1)
end
return -((lowerK*-t) / (lowerK + t + 1))
end
-- DEADZONE
local DEADZONE = 0.1
local function toSCurveSpace(t)
return (1 + DEADZONE) * (2*math.abs(t) - 1) - DEADZONE
end
local function fromSCurveSpace(t)
return t/2 + 0.5
end
local function gamepadLinearToCurve(thumbstickPosition)
local function onAxis(axisValue)
local sign = 1
if axisValue < 0 then
sign = -1
end
local point = fromSCurveSpace(SCurveTranform(toSCurveSpace(math.abs(axisValue))))
point = point * sign
return clamp(-1, 1, point)
end
return Vector2_new(onAxis(thumbstickPosition.x), onAxis(thumbstickPosition.y))
end
function this:UpdateGamepad()
local gamepadPan = this.GamepadPanningCamera
if gamepadPan and (hasGameLoaded or not VRService.VREnabled) then
gamepadPan = gamepadLinearToCurve(gamepadPan)
local currentTime = tick()
if gamepadPan.X ~= 0 or gamepadPan.Y ~= 0 then
this.userPanningTheCamera = true
elseif gamepadPan == ZERO_VECTOR2 then
lastThumbstickRotate = nil
if lastThumbstickPos == ZERO_VECTOR2 then
currentSpeed = 0
end
end
local finalConstant = 0
if lastThumbstickRotate then
if VRService.VREnabled then
currentSpeed = vrMaxSpeed
else
local elapsedTime = (currentTime - lastThumbstickRotate) * 10
currentSpeed = currentSpeed + (maxSpeed * ((elapsedTime*elapsedTime)/numOfSeconds))
if currentSpeed > maxSpeed then currentSpeed = maxSpeed end
if lastVelocity then
local velocity = (gamepadPan - lastThumbstickPos)/(currentTime - lastThumbstickRotate)
local velocityDeltaMag = (velocity - lastVelocity).magnitude
if velocityDeltaMag > 12 then
currentSpeed = currentSpeed * (20/velocityDeltaMag)
if currentSpeed > maxSpeed then currentSpeed = maxSpeed end
end
end
end
local success, gamepadCameraSensitivity = pcall(function() return GameSettings.GamepadCameraSensitivity end)
finalConstant = success and (gamepadCameraSensitivity * currentSpeed) or currentSpeed
lastVelocity = (gamepadPan - lastThumbstickPos)/(currentTime - lastThumbstickRotate)
end
lastThumbstickPos = gamepadPan
lastThumbstickRotate = currentTime
return Vector2_new( gamepadPan.X * finalConstant, gamepadPan.Y * finalConstant * ySensitivity * GameSettings:GetCameraYInvertValue())
end
return ZERO_VECTOR2
end
local InputBeganConn, InputChangedConn, InputEndedConn, MenuOpenedConn, ShiftLockToggleConn, GamepadConnectedConn, GamepadDisconnectedConn, TouchActivateConn = nil, nil, nil, nil, nil, nil, nil, nil
function this:DisconnectInputEvents()
if InputBeganConn then
InputBeganConn:disconnect()
InputBeganConn = nil
end
if InputChangedConn then
InputChangedConn:disconnect()
InputChangedConn = nil
end
if InputEndedConn then
InputEndedConn:disconnect()
InputEndedConn = nil
end
if MenuOpenedConn then
MenuOpenedConn:disconnect()
MenuOpenedConn = nil
end
if ShiftLockToggleConn then
ShiftLockToggleConn:disconnect()
ShiftLockToggleConn = nil
end
if GamepadConnectedConn then
GamepadConnectedConn:disconnect()
GamepadConnectedConn = nil
end
if GamepadDisconnectedConn then
GamepadDisconnectedConn:disconnect()
GamepadDisconnectedConn = nil
end
if subjectStateChangedConn then
subjectStateChangedConn:disconnect()
subjectStateChangedConn = nil
end
if workspaceChangedConn then
workspaceChangedConn:disconnect()
workspaceChangedConn = nil
end
if TouchActivateConn then
TouchActivateConn:disconnect()
TouchActivateConn = nil
end
this.TurningLeft = false
this.TurningRight = false
this.LastCameraTransform = nil
self.LastSubjectCFrame = nil
this.UserPanningTheCamera = false
this.RotateInput = Vector2.new()
this.GamepadPanningCamera = Vector2.new(0,0)
-- Reset input states
startPos = nil
lastPos = nil
panBeginLook = nil
isRightMouseDown = false
isMiddleMouseDown = false
fingerTouches = {}
NumUnsunkTouches = 0
StartingDiff = nil
pinchBeginZoom = nil
-- Unlock mouse for example if right mouse button was being held down
if UserInputService.MouseBehavior ~= Enum.MouseBehavior.LockCenter then
UserInputService.MouseBehavior = Enum.MouseBehavior.Default
end
end
function this:ResetInputStates()
isRightMouseDown = false
isMiddleMouseDown = false
OnMousePanButtonReleased() -- this function doesn't seem to actually need parameters
if UserInputService.TouchEnabled then
--[[menu opening was causing serious touch issues
this should disable all active touch events if
they're active when menu opens.]]
for inputObject, value in pairs(fingerTouches) do
fingerTouches[inputObject] = nil
end
panBeginLook = nil
startPos = nil
lastPos = nil
this.UserPanningTheCamera = false
StartingDiff = nil
pinchBeginZoom = nil
NumUnsunkTouches = 0
end
end
function this.getGamepadPan(name, state, input)
if input.UserInputType == this.activeGamepad and input.KeyCode == Enum.KeyCode.Thumbstick2 then
if state == Enum.UserInputState.Cancel then
this.GamepadPanningCamera = ZERO_VECTOR2
return
end
local inputVector = Vector2.new(input.Position.X, -input.Position.Y)
if inputVector.magnitude > THUMBSTICK_DEADZONE then
this.GamepadPanningCamera = Vector2_new(input.Position.X, -input.Position.Y)
else
this.GamepadPanningCamera = ZERO_VECTOR2
end
end
end
function this.doGamepadZoom(name, state, input)
if input.UserInputType == this.activeGamepad and input.KeyCode == Enum.KeyCode.ButtonR3 and state == Enum.UserInputState.Begin then
if this.ZoomEnabled then
if this:GetCameraZoom() > 0.5 then
this:ZoomCamera(0)
else
this:ZoomCamera(10)
end
end
end
end
function this:BindGamepadInputActions()
ContextActionService:BindAction("RootCamGamepadPan", this.getGamepadPan, false, Enum.KeyCode.Thumbstick2)
ContextActionService:BindAction("RootCamGamepadZoom", this.doGamepadZoom, false, Enum.KeyCode.ButtonR3)
end
function this:ConnectInputEvents()
InputBeganConn = UserInputService.InputBegan:connect(function(input, processed)
if input.UserInputType == Enum.UserInputType.Touch then
OnTouchBegan(input, processed)
elseif input.UserInputType == Enum.UserInputType.MouseButton2 then
OnMouse2Down(input, processed)
elseif input.UserInputType == Enum.UserInputType.MouseButton3 then
OnMouse3Down(input, processed)
end
-- Keyboard
if input.UserInputType == Enum.UserInputType.Keyboard then
OnKeyDown(input, processed)
end
end)
InputChangedConn = UserInputService.InputChanged:connect(function(input, processed)
if input.UserInputType == Enum.UserInputType.Touch then
OnTouchChanged(input, processed)
elseif input.UserInputType == Enum.UserInputType.MouseMovement then
OnMouseMoved(input, processed)
elseif input.UserInputType == Enum.UserInputType.MouseWheel then
OnMouseWheel(input, processed)
end
end)
InputEndedConn = UserInputService.InputEnded:connect(function(input, processed)
if input.UserInputType == Enum.UserInputType.Touch then
OnTouchEnded(input, processed)
elseif input.UserInputType == Enum.UserInputType.MouseButton2 then
OnMouse2Up(input, processed)
elseif input.UserInputType == Enum.UserInputType.MouseButton3 then
OnMouse3Up(input, processed)
end
-- Keyboard
if input.UserInputType == Enum.UserInputType.Keyboard then
OnKeyUp(input, processed)
end
end)
if touchWorkspaceEventEnabled then
TouchActivateConn = UserInputService.TouchTapInWorld:connect(function(touchPos, processed)
if isDynamicThumbstickEnabled and not processed and not IsAToolEquipped and positionIntersectsGuiObject(touchPos, GestureArea) then
if lastTapTime and tick() - lastTapTime < MAX_TIME_FOR_DOUBLE_TAP then
local tween = {
from = this:GetCameraZoom(),
to = DefaultZoom,
start = tick(),
duration = 0.2,
func = function(from, to, alpha)
this:ZoomCamera(from + (to - from)*alpha)
return to
end
}
tweens["Zoom"] = tween
else
local humanoid = this:GetHumanoid()
if humanoid then
local player = PlayersService.LocalPlayer
if player and player.Character then
if humanoid and humanoid.Torso then
local tween = {
from = this.RotateInput,
to = calcLookBehindRotateInput(humanoid.Torso),
start = tick(),
duration = 0.2,
func = function(from, to, alpha)
to = calcLookBehindRotateInput(humanoid.Torso)
if to then
this.RotateInput = from + (to - from)*alpha
end
return to
end
}
tweens["Rotate"] = tween
-- reset old camera info so follow cam doesn't rotate us
this.LastCameraTransform = nil
end
end
end
end
lastTapTime = tick()
end
end)
end
MenuOpenedConn = GuiService.MenuOpened:connect(function()
this:ResetInputStates()
end)
workspaceChangedConn = workspace:GetPropertyChangedSignal("CurrentCamera"):Connect(onCurrentCameraChanged)
if workspace.CurrentCamera then
onCurrentCameraChanged()
end
ShiftLockToggleConn = ShiftLockController.OnShiftLockToggled.Event:connect(function()
this:UpdateMouseBehavior()
end)
this.RotateInput = Vector2.new()
this.activeGamepad = nil
local function assignActivateGamepad()
local connectedGamepads = UserInputService:GetConnectedGamepads()
if #connectedGamepads > 0 then
for i = 1, #connectedGamepads do
if this.activeGamepad == nil then
this.activeGamepad = connectedGamepads[i]
elseif connectedGamepads[i].Value < this.activeGamepad.Value then
this.activeGamepad = connectedGamepads[i]
end
end
end
if this.activeGamepad == nil then -- nothing is connected, at least set up for gamepad1
this.activeGamepad = Enum.UserInputType.Gamepad1
end
end
GamepadConnectedConn = UserInputService.GamepadDisconnected:connect(function(gamepadEnum)
if this.activeGamepad ~= gamepadEnum then return end
this.activeGamepad = nil
assignActivateGamepad()
end)
GamepadDisconnectedConn = UserInputService.GamepadConnected:connect(function(gamepadEnum)
if this.activeGamepad == nil then
assignActivateGamepad()
end
end)
self:BindGamepadInputActions()
assignActivateGamepad()
-- set mouse behavior
self:UpdateMouseBehavior()
end
--Process tweens related to tap-to-recenter and double-tap-to-zoom
--Needs to be called from specific cameras on each update
function this:ProcessTweens()
for name, tween in pairs(tweens) do
local alpha = math.min(1.0, (tick() - tween.start)/tween.duration)
tween.to = tween.func(tween.from, tween.to, alpha)
if math.abs(1 - alpha) < 0.0001 then
tweens[name] = nil
end
end
end
function this:SetEnabled(newState)
if newState ~= self.Enabled then
self.Enabled = newState
if self.Enabled then
self:ConnectInputEvents()
self.cframe = workspace.CurrentCamera.CFrame
else
self:DisconnectInputEvents()
end
end
end
local function OnPlayerAdded(player)
player.Changed:connect(function(prop)
if this.Enabled then
if prop == "CameraMode" or prop == "CameraMaxZoomDistance" or prop == "CameraMinZoomDistance" then
this:ZoomCameraFixedBy(0)
end
end
end)
local function OnCharacterAdded(newCharacter)
local humanoid = findPlayerHumanoid(player)
local start = tick()
while tick() - start < 0.3 and (humanoid == nil or humanoid.Torso == nil) do
wait()
humanoid = findPlayerHumanoid(player)
end
if humanoid and humanoid.Torso and player.Character == newCharacter then
local newDesiredLook = (humanoid.Torso.CFrame.lookVector - Vector3.new(0,0.23,0)).unit
local horizontalShift = findAngleBetweenXZVectors(newDesiredLook, this:GetCameraLook())
local vertShift = math.asin(this:GetCameraLook().y) - math.asin(newDesiredLook.y)
if not IsFinite(horizontalShift) then
horizontalShift = 0
end
if not IsFinite(vertShift) then
vertShift = 0
end
this.RotateInput = Vector2.new(horizontalShift, vertShift)
-- reset old camera info so follow cam doesn't rotate us
this.LastCameraTransform = nil
end
-- Need to wait for camera cframe to update before we zoom in
-- Not waiting will force camera to original cframe
wait()
this:ZoomCamera(this.DefaultZoom)
end
player.CharacterAdded:connect(function(character)
if this.Enabled or SetCameraOnSpawn then
OnCharacterAdded(character)
SetCameraOnSpawn = false
end
end)
if player.Character then
spawn(function() OnCharacterAdded(player.Character) end)
end
end
if PlayersService.LocalPlayer then
OnPlayerAdded(PlayersService.LocalPlayer)
end
PlayersService.ChildAdded:connect(function(child)
if child and PlayersService.LocalPlayer == child then
OnPlayerAdded(PlayersService.LocalPlayer)
end
end)
local function OnGameLoaded()
hasGameLoaded = true
end
spawn(function()
if game:IsLoaded() then
OnGameLoaded()
else
game.Loaded:wait()
OnGameLoaded()
end
end)
local function OnDynamicThumbstickEnabled()
if UserInputService.TouchEnabled then
isDynamicThumbstickEnabled = true
end
end
local function OnDynamicThumbstickDisabled()
isDynamicThumbstickEnabled = false
end
local function OnGameSettingsTouchMovementModeChanged()
if LocalPlayer.DevTouchMovementMode == Enum.DevTouchMovementMode.UserChoice then
if GameSettings.TouchMovementMode.Name == "DynamicThumbstick" then
OnDynamicThumbstickEnabled()
else
OnDynamicThumbstickDisabled()
end
end
end
local function OnDevTouchMovementModeChanged()
if LocalPlayer.DevTouchMovementMode.Name == "DynamicThumbstick" then
OnDynamicThumbstickEnabled()
else
OnGameSettingsTouchMovementModeChanged()
end
end
if PlayersService.LocalPlayer then
PlayersService.LocalPlayer.Changed:Connect(function(prop)
if prop == "DevTouchMovementMode" then
OnDevTouchMovementModeChanged()
end
end)
OnDevTouchMovementModeChanged()
end
GameSettings.Changed:Connect(function(prop)
if prop == "TouchMovementMode" then
OnGameSettingsTouchMovementModeChanged()
end
end)
OnGameSettingsTouchMovementModeChanged()
GameSettings:SetCameraYInvertVisible()
pcall(function() GameSettings:SetGamepadCameraSensitivityVisible() end)
return this
end
return CreateCamera
|
--Setup animation here-- |
setup(animation.ControlSurfaces.ElevatorL,0.03)
setup(animation.ControlSurfaces.ElevatorR,0.03)
setup(animation.ControlSurfaces.Rudder,0.03)
setupInside(animation.Wings.WFL.Aileron,0.03)
setupInside(animation.Wings.WFR.Aileron,0.03)
setupInside(animation.Gears.NG.Wheel,0.03)
setup(animation.Wipers.L,0.05)
setup(animation.Wipers.R,0.05)
setup(animation.Engines.E1)
setup(animation.Engines.E2)
setup(animation.Doors.FLD,0.01)
setup(animation.Doors.FRD,0.01)
setup(animation.Doors.RLD,0.01)
setup(animation.Doors.RRD,0.01)
setup(animation.Doors.CD1,0.01)
setup(animation.Doors.CD2,0.01)
setupInside(animation.Doors.FLD.Door,0.01)
setupInside(animation.Doors.FRD.Door,0.01)
setupInside(animation.Doors.RLD.Door,0.01)
setupInside(animation.Doors.RRD.Door,0.01)
setup(animation.Wings.WRL)
setup(animation.Wings.WRR)
setup(animation.Wings.WFL,0.002)
setup(animation.Wings.WFR,0.002)
setup(animation.Gears.NG,0.005)
setup(animation.Gears.LG,0.005)
setup(animation.Gears.RG,0.005)
setupInside(animation.Gears.LG.S,0.005)
setupInside(animation.Gears.RG.S,0.005)
setup(animation.Gears.NGDL1,0.015)
setup(animation.Gears.NGDR1,0.015)
setup(animation.Gears.NGDL2,0.015)
setup(animation.Gears.NGDR2,0.015)
setup(animation.Gears.LGD,0.005)
setup(animation.Gears.RGD,0.005)
setupInside(animation.Gears.LGD.GD2)
setupInside(animation.Gears.RGD.GD2)
setup(animation.Gears.LGBD,0.015)
setup(animation.Gears.RGBD,0.015)
setupInside(animation.Wings.WFL.Flap,0.002)
setupInside(animation.Wings.WRL.Flap,0.002)
setupInside(animation.Wings.WFR.Flap,0.002)
setupInside(animation.Wings.WRR.Flap,0.002)
setupInside(animation.Wings.WFL.Fairing,0.002)
setupInside(animation.Wings.WFR.Fairing,0.002)
setupInside(animation.Wings.WRL.Fairing,0.002)
setupInside(animation.Wings.WRR.Fairing,0.002)
setupInside(animation.Wings.WFL.Slat,0.002)
setupInside(animation.Wings.WRL.Slat,0.002)
setupInside(animation.Wings.WFR.Slat,0.002)
setupInside(animation.Wings.WRR.Slat,0.002)
setupInside(animation.Wings.WFL.Spoiler,0.01)
setupInside(animation.Wings.WRL.Spoiler,0.01)
setupInside(animation.Wings.WFR.Spoiler,0.01)
setupInside(animation.Wings.WRR.Spoiler,0.01)
setup(animation.Light,0.01)
setup(animation.Instruments.GearLever,0.05)
setup(animation.Instruments.Throttle,0.03)
setup(animation.Instruments.JotStick1,0.03)
setupInside(animation.Instruments.JotStick1.Roll,0.03)
setupInside(animation.Instruments.JotStick1.Roll.PitchStick,0.03)
setupInside(animation.Instruments.JotStick1.Roll.PitchStick.RollStick,0.03)
setup(animation.Instruments.JotStick2,0.03)
setupInside(animation.Instruments.JotStick2.Roll,0.03)
setupInside(animation.Instruments.JotStick2.Roll.PitchStick,0.03)
setupInside(animation.Instruments.JotStick2.Roll.PitchStick.RollStick,0.03)
setup(animation.Instruments.Rudder1,0.03)
setup(animation.Instruments.Rudder2,0.03)
setup(animation.Instruments.Spoiler,0.03)
setup(animation.Instruments.Flap,0.03)
setup(animation.Doors.Cockpit,0.05)
setup(animation.Doors.PilotRestroom,0.05)
setup(animation.Doors.Restroom1,0.05)
setup(animation.Doors.Restroom2,0.05)
setup(animation.EmergencyExits.One)
setup(animation.EmergencyExits.Two)
setup(animation.EmergencyExits.Three)
setup(animation.EmergencyExits.Four)
setup(animation.Slides.FL)
setup(animation.Slides.FR)
setup(animation.Slides.RL)
setup(animation.Slides.RR)
setup(animation.Slides.WL)
setup(animation.Slides.WR)
setupInside(animation.Slides.FL.Parts)
setupInside(animation.Slides.FR.Parts)
setupInside(animation.Slides.RL.Parts)
setupInside(animation.Slides.RR.Parts)
setupInside(animation.Slides.WL.Parts)
setupInside(animation.Slides.WR.Parts)
setupInside(animation.Slides.FL.CanCollide)
setupInside(animation.Slides.FR.CanCollide)
setupInside(animation.Slides.RL.CanCollide)
setupInside(animation.Slides.RR.CanCollide)
setupInside(animation.Slides.WL.CanCollide)
setupInside(animation.Slides.WR.CanCollide)
setup(animation.Reversers) -- IAE and neo
wait(2)
animation.Engines.E1.A.Motor.DesiredAngle = 100e100
animation.Engines.E2.A.Motor.DesiredAngle = 100e100
animation.Gears.NGDL1.A.Motor.DesiredAngle = 1
animation.Gears.NGDR1.A.Motor.DesiredAngle = 1
animation.Gears.LGD.A.Motor.DesiredAngle = 1.45
animation.Gears.RGD.A.Motor.DesiredAngle = 1.45
animation.Gears.LGD.GD2.A.Motor.C1 = animation.Gears.LGD.GD2.A.Motor.C1 * CFrame.new(1.5,0,0)
animation.Gears.RGD.GD2.A.Motor.C1 = animation.Gears.RGD.GD2.A.Motor.C1 * CFrame.new(1.5,0,0)
animation.Wings.WFL.Aileron.A.Motor.DesiredAngle = 0.5
animation.Wings.WFR.Aileron.A.Motor.DesiredAngle = -0.5
animation.ControlSurfaces.ElevatorL.A.Motor.DesiredAngle = -0.3
animation.ControlSurfaces.ElevatorR.A.Motor.DesiredAngle = -0.3
animation.ControlSurfaces.Rudder.A.Motor.DesiredAngle = 0.2
wait(5)
unAnchor(script.Parent.AnimationParts)
Chassis.Anchored = false
|
-- Player specific convenience variables |
local MyPlayer = nil
local MyCharacter = nil
local MyHumanoid = nil
local MyTorso = nil
local MyMouse = nil
local RecoilAnim
local RecoilTrack = nil
local ReloadAnim
local ReloadTrack = nil
local IconURL = Tool.TextureId
local DebrisService = game:GetService('Debris')
local PlayersService = game:GetService('Players')
local FireSound
local OnFireConnection = nil
local OnReloadConnection = nil
local DecreasedAimLastShot = false
local LastSpreadUpdate = time()
local flare = script.Parent:WaitForChild("Flare")
local FlashHolder = nil
local WorldToCellFunction = Workspace.Terrain.WorldToCellPreferSolid
local GetCellFunction = Workspace.Terrain.GetCell
function RayIgnoreCheck(hit, pos)
if hit then
if hit.Transparency >= 1 or string.lower(hit.Name) == "water" or
hit.Name == "Effect" or hit.Name == "Rocket" or hit.Name == "Bullet" or
hit.Name == "Handle" or hit:IsDescendantOf(MyCharacter) then
return true
elseif hit:IsA('Terrain') and pos then
local cellPos = WorldToCellFunction(Workspace.Terrain, pos)
if cellPos then
local cellMat = GetCellFunction(Workspace.Terrain, cellPos.x, cellPos.y, cellPos.z)
if cellMat and cellMat == Enum.CellMaterial.Water then
return true
end
end
end
end
return false
end
|
----------------------------------
------------FUNCTIONS-------------
---------------------------------- |
function Receive(player, action, ...)
local args = {...}
if player == User and action == "play" then
Connector:FireAllClients("play", User, args[1], Settings.SoundSource.Position, Settings.PianoSoundRange, Settings.PianoSounds, args[2], Settings.IsCustom)
HighlightPianoKey((args[1] > 61 and 61) or (args[1] < 1 and 1) or args[1],args[3])
elseif player == User and action == "abort" then
Deactivate()
if SeatWeld then
SeatWeld:remove()
end
end
end
function Activate(player)
Connector:FireClient(player, "activate", Settings.CameraCFrame, Settings.PianoSounds, true)
User = player
Startup()
end
function Deactivate()
coroutine.resume(coroutine.create(Shutdown))
wait()
if User and User.Parent then
Connector:FireClient(User, "deactivate")
User.Character:SetPrimaryPartCFrame(Box.CFrame + Vector3.new(0, 5, 0))
end
User = nil
end
|
--[[ Now for the rest ]] |
local Lighting = game:GetService("Lighting")
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local gamepassId = 184464896 --Put the ID of the asset here
local toolNames = {"Portal Gun"} --Must be in lighting
local toolsParent = Lighting
local function onPlayerAdded(player)
local function onCharacterAdded(character)
if MarketplaceService:UserOwnsGamePassAsync(player.UserId, gamepassId) then
for i = 1, #toolNames do
local tool = toolsParent:FindFirstChild(toolNames[i])
if tool then
local clone = tool:Clone()
clone.Parent = player.Backpack
end
end
end
end
if player.Character then
onCharacterAdded(player.Character)
end
player.CharacterAdded:Connect(onCharacterAdded)
end
Players.PlayerAdded:Connect(onPlayerAdded)
|
--[=[
Returns the remaining time before the AccelTween attains the target.
@readonly
@prop rtime number
@within AccelTween
]=] | |
--Precalculated paths |
local t,f,n=true,false,{}
local r={
[58]={{45,44,28,29,31,32,34,35,39,41,30,56,58},t},
[49]={{45,49},t},
[16]={n,f},
[19]={{45,44,28,29,31,32,34,35,39,41,30,56,58,20,19},t},
[59]={{45,44,28,29,31,32,34,35,39,41,59},t},
[63]={{45,44,28,29,31,32,34,35,39,41,30,56,58,23,62,63},t},
[34]={{45,44,28,29,31,32,34},t},
[21]={{45,44,28,29,31,32,34,35,39,41,30,56,58,20,21},t},
[48]={{45,49,48},t},
[27]={{45,44,28,27},t},
[14]={n,f},
[31]={{45,44,28,29,31},t},
[56]={{45,44,28,29,31,32,34,35,39,41,30,56},t},
[29]={{45,44,28,29},t},
[13]={n,f},
[47]={{45,49,48,47},t},
[12]={n,f},
[45]={{45},t},
[57]={{45,44,28,29,31,32,34,35,39,41,30,56,57},t},
[36]={{45,44,28,29,31,32,33,36},t},
[25]={{45,44,28,27,26,25},t},
[71]={{45,44,28,29,31,32,34,35,39,41,59,61,71},t},
[20]={{45,44,28,29,31,32,34,35,39,41,30,56,58,20},t},
[60]={{45,44,28,29,31,32,34,35,39,41,60},t},
[8]={n,f},
[4]={n,f},
[75]={{45,44,28,29,31,32,34,35,39,41,59,61,71,72,76,73,75},t},
[22]={{45,44,28,29,31,32,34,35,39,41,30,56,58,20,21,22},t},
[74]={{45,44,28,29,31,32,34,35,39,41,59,61,71,72,76,73,74},t},
[62]={{45,44,28,29,31,32,34,35,39,41,30,56,58,23,62},t},
[1]={n,f},
[6]={n,f},
[11]={n,f},
[15]={n,f},
[37]={{45,44,28,29,31,32,33,36,37},t},
[2]={n,f},
[35]={{45,44,28,29,31,32,34,35},t},
[53]={{45,49,48,47,52,53},t},
[73]={{45,44,28,29,31,32,34,35,39,41,59,61,71,72,76,73},t},
[72]={{45,44,28,29,31,32,34,35,39,41,59,61,71,72},t},
[33]={{45,44,28,29,31,32,33},t},
[69]={{45,44,28,29,31,32,34,35,39,41,60,69},t},
[65]={{45,44,28,29,31,32,34,35,39,41,30,56,58,20,19,66,64,65},t},
[26]={{45,44,28,27,26},t},
[68]={{45,44,28,29,31,32,34,35,39,41,30,56,58,20,19,66,64,67,68},t},
[76]={{45,44,28,29,31,32,34,35,39,41,59,61,71,72,76},t},
[50]={{45,49,48,47,50},t},
[66]={{45,44,28,29,31,32,34,35,39,41,30,56,58,20,19,66},t},
[10]={n,f},
[24]={{45,44,28,27,26,25,24},t},
[23]={{45,44,28,29,31,32,34,35,39,41,30,56,58,23},t},
[44]={{45,44},t},
[39]={{45,44,28,29,31,32,34,35,39},t},
[32]={{45,44,28,29,31,32},t},
[3]={n,f},
[30]={{45,44,28,29,31,32,34,35,39,41,30},t},
[51]={{45,49,48,47,50,51},t},
[18]={n,f},
[67]={{45,44,28,29,31,32,34,35,39,41,30,56,58,20,19,66,64,67},t},
[61]={{45,44,28,29,31,32,34,35,39,41,59,61},t},
[55]={{45,49,48,47,52,53,54,55},t},
[46]={{45,49,48,47,46},t},
[42]={{45,44,28,29,31,32,34,35,38,42},t},
[40]={{45,44,28,29,31,32,34,35,40},t},
[52]={{45,49,48,47,52},t},
[54]={{45,49,48,47,52,53,54},t},
[43]={n,f},
[7]={n,f},
[9]={n,f},
[41]={{45,44,28,29,31,32,34,35,39,41},t},
[17]={n,f},
[38]={{45,44,28,29,31,32,34,35,38},t},
[28]={{45,44,28},t},
[5]={n,f},
[64]={{45,44,28,29,31,32,34,35,39,41,30,56,58,20,19,66,64},t},
}
return r
|
--[=[
@interface KnitOptions
.ServicePromises boolean?
.Middleware Middleware?
.PerServiceMiddleware PerServiceMiddleware?
@within KnitClient
- `ServicePromises` defaults to `true` and indicates if service methods use promises.
- Each service will go through the defined middleware, unless the service
has middleware defined in `PerServiceMiddleware`.
]=] |
type KnitOptions = {
ServicePromises: boolean,
Middleware: Middleware?,
PerServiceMiddleware: PerServiceMiddleware?,
}
local defaultOptions: KnitOptions = {
ServicePromises = true,
Middleware = nil,
PerServiceMiddleware = {},
}
local selectedOptions = nil
|
--[[_________________________________________________
!!!Put this is StarterPack OR IT WILL NOT WORK!!!
_________________________________________________
--]]
--Do not edit the Below unless you know what you are doing!--
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
wait(1)
while true do
wait(0.001)
if script.Parent.TextButton.Text ==("Click to disable Rainbow Trail")then
fs = Instance.new("Part")
fs.TopSurface = "Smooth"
fs.BottomSurface = "Smooth"
fs.Anchored = true
fs.FormFactor = "Custom"
fs.Shape = "Ball"
fs.Size = Vector3.new(0.9, 1.5, 0.9)
fs.Transparency = 0.2
fs.CanCollide = false
fs.BrickColor = BrickColor.Random()
fs.CFrame = script.Parent.Parent.Parent.Character:FindFirstChild("Torso").CFrame
fs.Parent = game.Workspace
game.Debris:AddItem(fs,1)
end
end
|
---WeldConstraint anything you want to move to the TargetL_Closed and TargetR_Closed MeshParts.
---TargetL_Closed and TargetR_Closed should be anchored but child welded objects that move with TargetL_Closed and TargetR_Closed should not be anchored.
---You may move, rotate and scale the Targets but for a simple door only translation is used.
---IntValue Speed controls the doors speed to open and close.
---After you have finished creating your door turn the transparency of Trigger, TargetL_Closed, TargetL_Open, TargetR_Closed and TargetR_Open to 1 or fully transparent. |
local TweenService = game:GetService("TweenService")
local model = script.Parent
local trigger = model.Trigger
local left = model.TargetL_Closed
local right = model.TargetR_Closed
local doorTrigger = model.DoorTrigger.Value
local tweenInfo = TweenInfo.new (
model.Speed.Value, --Time/Speed of Door Tween
Enum.EasingStyle.Quart, --Easing Style
Enum.EasingDirection.InOut, --EasingDirection
0, --Repeat Count
false, --Reverse true
0 --Delay
)
local DoorState = {
["Closed"] = 1,
["Opening"] = 2,
["Open"] = 3,
["Closing"] = 4,
}
local doorState = DoorState.Closed
local playersNear = {}
local tweenL = TweenService:Create(left, tweenInfo, {CFrame = model.TargetL_Open.CFrame})
local tweenR = TweenService:Create(right, tweenInfo, {CFrame = model.TargetR_Open.CFrame})
local tweenLClose = TweenService:Create(left, tweenInfo, {CFrame = model.TargetL_Closed.CFrame})
local tweenRClose = TweenService:Create(right, tweenInfo, {CFrame = model.TargetR_Closed.CFrame})
local function StartOpening()
doorTrigger.CanTouch = false
print("False")
doorState = DoorState.Opening
model["Door"]:Play()
tweenL:Play()
tweenR:Play()
wait(7)
doorTrigger.CanTouch = true
print("True")
end
local function StartClosing()
doorState = DoorState.Closing
--model["Door"]:Play()
tweenLClose:Play()
tweenRClose:Play()
end
local function tweenOpenCompleted(playbackState)
if(next(playersNear) == nil) then
StartClosing()
else
doorState = DoorState.Open
end
end
local function tweenCloseCompleted(playbackState)
if(next(playersNear) ~= nil) then
StartOpening()
else
doorState = DoorState.Closed
end
end
tweenL.Completed:Connect(tweenOpenCompleted)
tweenLClose.Completed:Connect(tweenCloseCompleted)
local function touched(otherPart)
if(otherPart.Name == "HumanoidRootPart" ) then
local player = game.Players:FindFirstChild(otherPart.Parent.Name)
if(player) then
--print("touch")
playersNear[player] = 1
if(doorState == DoorState.Closed) then
StartOpening()
end
end
end
end
|
--[[Susupension]] |
Tune.SusEnabled = true -- works only in with PGSPhysicsSolverEnabled, defaults to false when PGS is disabled
--Front Suspension
Tune.FSusDamping = 50 -- Spring Dampening
Tune.FSusStiffness = 9000 -- Spring Force
Tune.FSusLength = 1 -- Suspension length (in studs)
Tune.FSusMaxExt = .3 -- Max Extension Travel (in studs)
Tune.FSusMaxComp = .3 -- Max Compression Travel (in studs)
Tune.FSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.FWsBoneLen = 1 -- Wishbone Length
Tune.FWsBoneAngle = 10 -- 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 = 50 -- Spring Dampening
Tune.RSusStiffness = 9000 -- Spring Force
Tune.RSusLength = 1 -- Suspension length (in studs)
Tune.RSusMaxExt = .3 -- Max Extension Travel (in studs)
Tune.RSusMaxComp = .3 -- Max Compression Travel (in studs)
Tune.RSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.RWsBoneLen = 1 -- Wishbone Length
Tune.RWsBoneAngle = 10 -- 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 = false -- Wishbone Visible
Tune.SusRadius = .2 -- Suspension Coil Radius
Tune.SusThickness = .1 -- Suspension Coil Thickness
Tune.SusColor = "Really black" -- Suspension Color [BrickColor]
Tune.SusCoilCount = 6 -- Suspension Coil Count
Tune.WsColor = "Black" -- Wishbone Color [BrickColor]
Tune.WsThickness = .1 -- Wishbone Rod Thickness
|
--Sir_Falstaff wuz here |
local TweenService = game:GetService("TweenService")
local FogTweenInfo = TweenInfo.new(5,Enum.EasingStyle.Linear) |
-- Make signal strict |
setmetatable(Signal, {
__index = function(_tb, key)
error(("Attempt to get Signal::%s (not a valid member)"):format(tostring(key)), 2)
end,
__newindex = function(_tb, key, _value)
error(("Attempt to set Signal::%s (not a valid member)"):format(tostring(key)), 2)
end,
})
return {
new = Signal.new,
Wrap = Signal.Wrap,
Is = Signal.Is,
}
|
--[[
Performs a left-fold of the list with the given initial value and callback.
]] |
local function foldLeft(list, callback, initialValue)
local accum = initialValue
for i = 1, #list do
accum = callback(accum, list[i], i)
end
return accum
end
return foldLeft
|
-- local tix = Instance.new("TextButton", cl)
-- tix.Style = "Custom"
-- tix.Size = UDim2.new(0,35,1,0)
-- tix.TextScaled=true
-- tix.Position = UDim2.new(1,-75,0,0)
-- tix.ZIndex = 2
-- tix.Font = "Arial"
-- tix.FontSize = "Size18"
-- tix.Text = "TIX"
-- tix.BackgroundColor3=Color3.new(1,1,0)
-- tix.BorderSizePixel=0
-- tix.TextColor3=Color3.new(1,1,1)
-- tix.BackgroundTransparency=0.5
-- tix.MouseButton1Click:connect(function()
-- service.MarketPlace:PromptPurchase(localplayer,v.ID,false,Enum.CurrencyType.Tix)
-- end) |
extraPane.CanvasSize=UDim2.new(0,0,(num+1)/20,0)
num = num +1
end
extraPane.CanvasSize=UDim2.new(0,0,(num+1)/20,0)
robux.MouseButton1Click:connect(function()
service.MarketPlace:PromptPurchase(localplayer, pass[1])
end)
--tickets.MouseButton1Click:connect(function()
-- service.MarketPlace:PromptPurchase(localplayer,pass[1],false,Enum.CurrencyType.Tix)
--end)
extra.MouseButton1Click:connect(function()
service.MarketPlace:PromptPurchase(localplayer,304651585)
--[[
if not extraPane.Visible then
extraPane.Visible = true
else
extraPane.Visible = false
end--]]
end)
if playerData.isDonor then
status.Text = "Donated"
capeTexture.TextTransparency=0
capeMaterial.TextTransparency=0
capeColor.TextTransparency=0
capeColor.BackgroundTransparency=0
capeToggle.TextTransparency=0
local ored,ogreen,oblue = 255*currentColor.r,255*currentColor.g,255*currentColor.b
local newColor = currentColor
local debounce = false
local function updateStatus()
status.Text = "Updating..."
status.Text = client.Remote.Get("UpdateDonor",playerData.Donor)
wait(0.5)
status.Text = "Donated"
end
local function showColorPicker()
color.BackgroundColor3 = currentColor
red.Text = ored
green.Text = ogreen
blue.Text = oblue
materialPicker.Visible = false
texturePicker.Visible = false
colorPicker.Visible = true
end
local function showMaterialPicker()
materialPicker.Visible = true
texturePicker.Visible = false
colorPicker.Visible = false
end
local function showTexturePicker()
texturePicker.Frame.ID.Text = currentTexture
texturePicker.Frame.Image.Image = "rbxassetid://"..currentTexture
materialPicker.Visible = false
texturePicker.Visible = true
colorPicker.Visible = false
end
-- Color Picker
local function updateColor()
local nred,ngreen,nblue = tonumber(red.Text),tonumber(green.Text),tonumber(blue.Text)
if not nred then
nred = 0
end
if not ngreen then
ngreen = 0
end
if not nblue then
nblue = 0
end
if nred>255 then nred=255 end
if ngreen>255 then ngreen=255 end
if nblue>255 then nblue=255 end
nred = math.floor(nred)
ngreen = math.floor(ngreen)
nblue = math.floor(nblue)
red.Text = nred
green.Text = ngreen
blue.Text = nblue
nred,ngreen,nblue = nred/255,ngreen/255,nblue/255
newColor = Color3.new(nred,ngreen,nblue)
color.BackgroundColor3 = newColor
end
red.Changed:connect(updateColor)
green.Changed:connect(updateColor)
blue.Changed:connect(updateColor)
confirmColor.MouseButton1Click:connect(function()
if not debounce then
debounce = true
playerData.Donor.Cape.Color = {newColor.r,newColor.g,newColor.b}
capeColor.BackgroundColor3 = newColor
ored,ogreen,oblue = newColor.r*255,newColor.g*255,newColor.b*255
currentColor = newColor
colorPicker.Visible = false
updateStatus()
debounce = false
end
end)
cancelColor.MouseButton1Click:connect(function()
newColor = currentColor
colorPicker.Visible = false
end)
-- Material Picker
local materials = {
"Brick";
"Cobblestone";
"Concrete";
"CorrodedMetal";
"DiamondPlate";
"Fabric";
"Foil";
"Granite";
"Grass";
"Ice";
"Marble";
"Metal";
"Neon";
"Pebble";
"Plastic";
"Sand";
"Slate";
"SmoothPlastic";
"Wood";
"WoodPlanks";
"Glass";
}
local materialEntry = materialPicker.Entry
local matNum = 0
for i,v in pairs(materials) do
local NewClone = materialEntry:clone()
NewClone.Parent = materialPicker.Frame
NewClone.Position = UDim2.new(0, 0, 0, matNum*20)
NewClone.Text = v
NewClone.Visible = true
NewClone.MouseButton1Click:connect(function()
if not debounce then
debounce = true
capeMaterial.Text = v
playerData.Donor.Cape.Material = v
materialPicker.Visible = false
updateStatus()
debounce = false
end
end)
matNum = matNum+1
materialPicker.Frame.CanvasSize = UDim2.new(0, 0, 0, matNum*20)
end
-- Texture Picker
local textureId = texturePicker.Frame.ID
local confirmId = texturePicker.Frame.Confirm
local cancelId = texturePicker.Frame.Cancel
local preview = texturePicker.Frame.Image
local newId = currentTexture
textureId.FocusLost:connect(function(enterPressed)
if enterPressed then
newId = tonumber(texturePicker.Frame.ID.Text)
if not newId then
textureId.Text = "Invalid!"
wait(1)
textureId.Text = currentTexture
preview.Image = "rbxassetid://"..currentTexture
else
capeTexture.Text = newId
preview.Image = "rbxassetid://"..newId
end
end
end)
confirmId.MouseButton1Click:connect(function()
if not debounce then
debounce = true
capeTexture.Text = newId
playerData.Donor.Cape.Image = newId
texturePicker.Visible = false
updateStatus()
debounce = false
end
end)
cancelId.MouseButton1Click:connect(function()
texturePicker.Visible = false
end)
-- Other
capeToggle.MouseButton1Click:connect(function()
if not debounce then
debounce = true
if playerData.Donor.Enabled then
playerData.Donor.Enabled = false
capeToggle.Text = "Disabled"
elseif not playerData.Donor.Enabled then
playerData.Donor.Enabled = true
capeToggle.Text = "Enabled"
end
updateStatus()
debounce = false
end
end)
capeMaterial.MouseButton1Click:connect(function()
if not materialPicker.Visible then
showMaterialPicker()
end
end)
capeTexture.MouseButton1Click:connect(function()
if not texturePicker.Visible then
showTexturePicker()
end
end)
capeColor.MouseButton1Click:connect(function()
if not colorPicker.Visible then
showColorPicker()
end
end)
else
status.Text = "Not a Donor"
capeTexture.TextTransparency=0.5
capeMaterial.TextTransparency=0.5
capeColor.TextTransparency=0.5
capeColor.BackgroundTransparency=0.5
capeToggle.TextTransparency=0.5
end
-- Keybinds
local Keybinds = keybindsTab.Keybinds
local addBind = keybindsTab.Add
local editBind = keybindsTab.Edit
local removeBind = keybindsTab.Removeb
local bindEntry = keybindsTab.Entry
local makeBind = addBind.AddBind
local confirmBind = makeBind.Add
local cancelBind = makeBind.Cancel
local command = makeBind.Command
local bindKey = makeBind.BindKey
local keyEntry = keybindsTab.Entry
local selectedKey
local selectedCommand
local selectedEntry
local newBind
local bindListener
bindKey.MouseButton1Click:connect(function()
client.Variables.WaitingForBind = true
bindKey.Text = "Waiting for key press..."
bindListener = service.UserInputService.InputBegan:connect(function(input)
if input.KeyCode then
newBind = input.KeyCode.Value
client.Variables.WaitingForBind = false
bindListener:disconnect()
bindListener = nil
bindKey.Text = string.char(newBind)
end
end)
end)
local function getBinds()
local num = 0
selectedKey = nil
selectedCommand = nil
selectedEntry = nil
Keybinds:ClearAllChildren()
for i,v in pairs(client.Variables.KeyBinds) do
local clone = keyEntry:clone()
clone.Text = "Key: "..string.char(i).." | Command: "..v
clone.Position = UDim2.new(0,0,0,num*20)
clone.Visible = true
clone.Parent = Keybinds
clone.MouseButton1Click:connect(function()
if selectedEntry then
selectedEntry.BackgroundTransparency = 1
end
clone.BackgroundTransparency = 0
selectedKey = i
selectedCommand = v
selectedEntry = clone
end)
num = num + 1
end
Keybinds.CanvasSize = UDim2.new(0,0,0,num*20)
end
confirmBind.MouseButton1Click:connect(function()
if command.Text~="" and newBind then
client.Functions.AddKeyBind(newBind,command.Text)
makeBind.Visible = false
newBind = nil
command.Text = ""
bindKey.Text = "Click to Bind"
getBinds()
end
end)
cancelBind.MouseButton1Click:connect(function()
makeBind.Visible = false
newBind = nil
command.Text = ""
bindKey.Text = "Click to Bind"
client.Variables.WaitingForBind = false
if bindListener then bindListener:disconnect() end
bindListener = nil
end)
addBind.MouseButton1Click:connect(function()
if not makeBind.Visible then
newBind = nil
command.Text = ""
bindKey.Text = "Click to Bind"
makeBind.Visible = true
end
end)
editBind.MouseButton1Click:connect(function()
if selectedKey and selectedCommand and selectedEntry then
newBind = nil
command.Text = selectedCommand
bindKey.Text = string.char(selectedKey)
makeBind.Visible = true
end
end)
removeBind.MouseButton1Click:connect(function()
if selectedKey and selectedCommand and selectedEntry then
client.Functions.RemoveKeyBind(selectedKey)
getBinds()
end
end)
getBinds()
--Settings
local SettingsScroll = settingsTab.Settings
local settingData = client.Remote.Get("AllSettings")
if not gui.Parent then return end
if settingData and type(settingData)=="table" then
settings.Visible = true
local sets,descs,order = settingData.Settings,settingData.Descs,settingData.Order
local num = 1
local clear = toggleBut:clone()
clear.Text = "Click 'Clear' to clear all saved settings"
clear.TextButton.Text = "Clear"
clear.TextButton.MouseButton1Click:connect(function()
client.Remote.Send("ClearSavedSettings")
end)
clear.Visible = true
Expand(clear, desc)
clear.Desc.Value = "Clears all saved settings"
clear.Position = UDim2.new(0,0,0,0)
clear.Parent = settingsTab.Settings
for i,set in pairs(order) do
local v = sets[set]
if set == " " then
local clone = stringBut:Clone()
clone.Text = " "
clone.TextBox.Visible = false
clone.Position = UDim2.new(0,0,0,num*20)
clone.Visible = true
clone.Parent = settingsTab.Settings
num = num+1
elseif v~=nil then
if type(v)=="string" or type(v)=="number" then
if set == "Theme" or set == "MobileTheme" then
local clone = toggleBut:Clone()
local materialPicker = materialPicker:Clone()
materialPicker.Parent = clone
local materialEntry = materialPicker.Entry
materialPicker.Position = UDim2.new(1,-200,0,0)
local function showPicker()
local matNum = 0
local themes = {}
for i,v in pairs(client.Deps.UI:GetChildren()) do
table.insert(themes,v.Name)
end
materialPicker.Frame:ClearAllChildren()
for i,v in pairs(themes) do
local NewClone = materialEntry:clone()
NewClone.Parent = materialPicker.Frame
NewClone.Position = UDim2.new(0, 0, 0, matNum*20)
NewClone.Text = v
NewClone.Visible = true
NewClone.MouseButton1Click:connect(function()
materialPicker.Visible = false
clone.TextButton.Text = v
sets[set] = v
client.Remote.Send("SaveSetSetting",set,v)
end)
matNum = matNum+1
materialPicker.Frame.CanvasSize = UDim2.new(0, 0, 0, matNum*20)
end --// #lazySunday
materialPicker.Visible = true
end
clone.Text = set..": "
if descs[set] then
clone.Desc.Value = descs[set]
else
clone.Desc.Value = set
end
clone.Position = UDim2.new(0,0,0,num*20)
clone.Visible = true
Expand(clone,desc)
clone.TextButton.Text = v
clone.TextButton.MouseButton1Down:connect(function()
showPicker()
end)
clone.Parent = settingsTab.Settings
num = num+1
else
local clone = stringBut:Clone()
clone.Text = set..": "
clone.TextBox.Text = v
if descs[set] then
clone.Desc.Value = descs[set]
else
clone.Desc.Value = set
end
clone.Position = UDim2.new(0,0,0,num*20)
clone.Visible = true
Expand(clone,desc)
clone.TextBox.FocusLost:connect(function(enterPressed)
if enterPressed then
if type(v) == "number" then
if tonumber(clone.TextBox.Text) then
sets[set] = tonumber(clone.TextBox.Text)
client.Remote.Send("SaveSetSetting",set,sets[set])
else
clone.TextBox.Text = v
end
else
sets[set] = clone.TextBox.Text
client.Remote.Send("SaveSetSetting",set,sets[set])
end
else
clone.TextBox.Text = v
end
end)
clone.Parent = settingsTab.Settings
num = num+1
end
elseif type(v)=="boolean" then
local clone = toggleBut:Clone()
clone.Text = set..": "
if descs[set] then
clone.Desc.Value = descs[set]
else
clone.Desc.Value = set
end
clone.Position = UDim2.new(0,0,0,num*20)
clone.Visible = true
Expand(clone,desc)
local enabled = v
if enabled then
clone.TextButton.Text = "Enabled"
else
clone.TextButton.Text = "Disabled"
end
clone.TextButton.MouseButton1Down:connect(function()
if enabled then
sets[set] = false
enabled = false
clone.TextButton.Text = "Disabled"
client.Remote.Send("SaveSetSetting",set,sets[set])
else
sets[set] = true
enabled = true
clone.TextButton.Text = "Enabled"
client.Remote.Send("SaveSetSetting",set,sets[set])
end
end)
clone.Parent = settingsTab.Settings
num = num+1
elseif type(v)=="userdata" then
if set=="TopbarColor" then
local clone = colorBut:Clone()
clone.Text = set..": "
if descs[set] then
clone.Desc.Value = descs[set]
else
clone.Desc.Value = set
end
clone.Position = UDim2.new(0,0,0,num*20)
clone.Visible = true
Expand(clone,desc)
clone.TextButton.BackgroundColor3 = v
local ored,ogreen,oblue = v.r*255,v.g*255,v.b*255
local colorPicker = clone.ColorPicker
colorPicker.Parent = settingsTab
colorPicker.Position = UDim2.new(1,20,0,0)
local red = colorPicker.Frame.R
local green = colorPicker.Frame.G
local blue = colorPicker.Frame.B
local color = colorPicker.Frame.Color
local confirmColor = colorPicker.Frame.Confirm
local newColor = v
local currentColor = v
local function showColorPicker()
color.BackgroundColor3 = currentColor
red.Text = ored
green.Text = ogreen
blue.Text = oblue
colorPicker.Visible = true
end
-- Color Picker
local function updateColor()
local nred,ngreen,nblue = tonumber(red.Text),tonumber(green.Text),tonumber(blue.Text)
if not nred then
nred = 0
end
if not ngreen then
ngreen = 0
end
if not nblue then
nblue = 0
end
if nred>255 then nred=255 end
if ngreen>255 then ngreen=255 end
if nblue>255 then nblue=255 end
nred = math.floor(nred)
ngreen = math.floor(ngreen)
nblue = math.floor(nblue)
red.Text = nred
green.Text = ngreen
blue.Text = nblue
nred,ngreen,nblue = nred/255,ngreen/255,nblue/255
newColor = Color3.new(nred,ngreen,nblue)
color.BackgroundColor3 = newColor
end
red.Changed:connect(updateColor)
green.Changed:connect(updateColor)
blue.Changed:connect(updateColor)
confirmColor.MouseButton1Click:connect(function()
ored,ogreen,oblue = newColor.r*255,newColor.g*255,newColor.b*255
currentColor = newColor
colorPicker.Visible = false
clone.TextButton.BackgroundColor3 = newColor
sets[set] = newColor
client.Remote.Send("SaveSetSetting",set,sets[set])
end)
cancelColor.MouseButton1Click:connect(function()
newColor = currentColor
colorPicker.Visible = false
end)
clone.TextButton.MouseButton1Down:connect(function()
showColorPicker()
end)
clone.Parent = settingsTab.Settings
num = num+1
end
elseif type(v)=="table" then
local clone = tableBut:Clone()
clone.Text = set..": "
clone.TextButton.Text = "Edit"
if descs[set] then
clone.Desc.Value = descs[set]
else
clone.Desc.Value = set
end
clone.Position = UDim2.new(0,0,0,num*20)
clone.Visible = true
Expand(clone,desc)
local function closeAll()
for k,m in pairs(settingsTab:GetChildren()) do
if m:IsA("Frame") and m.Name~="Settings" then
m.Visible = false
end
end
end
if set=="Ranks" then
local Ranks = settingsTab.Ranks:clone()
Ranks.Parent = settingsTab
local add = Ranks.Add
local rem = Ranks.Removeb
local close = Ranks.Close
local newEntry = add.NewEntry
local confirm = newEntry.Add
local cancel = newEntry.Cancel
local groupId = newEntry.Group
local rank = newEntry.Rank
local type = newEntry.Type
local tab = Ranks.Table
local entBut = Ranks.Entry
local selectedEntry
local selectedRank
local selectedInd
local function populate()
tab:ClearAllChildren()
local newm = 0
for k,m in pairs(v) do
local new = entBut:Clone()
new.Text = "Group: "..m.Group.." | Rank: "..m.Rank.." | Type: "..m.Type
new.Position = UDim2.new(0,0,0,newm*20)
new.Visible = true
new.ZIndex = 2
new.Parent = tab
new.MouseButton1Click:connect(function()
if selectedEntry then
selectedEntry.BackgroundTransparency = 1
end
new.BackgroundTransparency = 0
selectedEntry = new
selectedRank = m
selectedInd = k
end)
newm=newm+1
end
tab.CanvasSize = UDim2.new(0,0,0,newm*20)
end
confirm.MouseButton1Click:connect(function()
if groupId.Text~="" and rank.Text~="" and type.Text~="" then
local tid = groupId.Text
local tr = rank.Text
local tt = type.Text
groupId.Text=""
rank.Text=""
type.Text=""
if tonumber(tid) then
tid = tonumber(tid)
end
table.insert(sets[set],{Group=tid,Rank=tr,Type=tt})
client.Remote.Send("SaveTableAdd",set,{Group=tid,Rank=tr,Type=tt})
newEntry.Visible = false
populate()
end
end)
cancel.MouseButton1Click:connect(function()
groupId.Text=""
rank.Text=""
type.Text=""
newEntry.Visible = false
end)
rem.MouseButton1Click:connect(function()
if selectedEntry and selectedRank and selectedInd then
table.remove(sets[set],selectedInd)
client.Remote.Send("SaveTableRemove",set,selectedRank)
populate()
end
end)
add.MouseButton1Click:connect(function()
groupId.Text=""
rank.Text=""
type.Text=""
closeAll()
if newEntry.Visible then
newEntry.Visible = false
else
newEntry.Visible = true
end
end)
close.MouseButton1Click:connect(function()
newEntry.Visible = false
Ranks.Visible = false
end)
clone.TextButton.MouseButton1Click:connect(function()
closeAll()
if Ranks.Visible then
Ranks.Visible = false
else
Ranks.Visible = true
end
end)
populate()
elseif set=="MusicList" then
local Music = settingsTab.Music:clone()
Music.Parent = settingsTab
local tab = Music.Table
local Add = Music.Add
local Close = Music.Close
local Entry = Music.Entry
local Remove = Music.Removeb
local newEnt = Add.NewEntry
local newAdd = newEnt.Add
local newCancel = newEnt.Cancel
local newId = newEnt.ID
local newName = newEnt.Nameb
local newPitch = newEnt.Pitch
local newVolume = newEnt.Volume
local selectedEntry
local selectedValue
local selectedInd
local function populate()
tab:ClearAllChildren()
local newm = 0
for k,m in pairs(v) do
local new = Entry:Clone()
new.Text = "Name: "..m.Name.." | ID: "..m.Id.." | Pitch: "..(m.Pitch or "N/A").." | Volume: "..(m.Volume or "N/A")
new.Position = UDim2.new(0,0,0,newm*20)
new.Visible = true
new.ZIndex = 2
new.Parent = tab
new.MouseButton1Click:connect(function()
if selectedEntry then
selectedEntry.BackgroundTransparency = 1
end
new.BackgroundTransparency = 0
selectedEntry = new
selectedValue = m
selectedInd = k
end)
newm=newm+1
end
tab.CanvasSize = UDim2.new(0,0,0,newm*20)
end
newAdd.MouseButton1Click:connect(function()
if newName.Text~="" and newPitch.Text~="" then
local name = newName.Text
local id = newId.Text
local pitch = newPitch.Text
local volume = newVolume.Text
newName.Text = ""
newId.Text = ""
newPitch.Text = ""
newVolume.Text = ""
if pitch=="" then
pitch = nil
end
if volume=="" then
volume = nil
end
table.insert(sets[set],{Name=name,Id=id,Pitch=pitch,Volume=volume})
client.Remote.Send("SaveTableAdd",set,{Name=name,Id=id,Pitch=pitch,Volume=volume})
newEnt.Visible = false
populate()
end
end)
newCancel.MouseButton1Click:connect(function()
newName.Text = ""
newId.Text = ""
newPitch.Text = ""
newVolume.Text = ""
newEnt.Visible = false
end)
Remove.MouseButton1Click:connect(function()
if selectedEntry and selectedValue and selectedInd then
table.remove(sets[set],selectedInd)
client.Remote.Send("SaveTableRemove",set,selectedValue)
populate()
end
end)
Add.MouseButton1Click:connect(function()
newName.Text = ""
newId.Text = ""
newPitch.Text = ""
newVolume.Text = ""
if newEnt.Visible then
newEnt.Visible = false
else
newEnt.Visible = true
end
end)
Close.MouseButton1Click:connect(function()
newEnt.Visible = false
Music.Visible = false
end)
clone.TextButton.MouseButton1Click:connect(function()
closeAll()
if Music.Visible then
Music.Visible = false
else
Music.Visible = true
end
end)
populate()
elseif set=="CapeList" then
local Capes = settingsTab.Capes:clone()
Capes.Parent = settingsTab
local tab = Capes.Table
local Add = Capes.Add
local Close = Capes.Close
local Entry = Capes.Entry
local Remove = Capes.Removeb
local newEnt = Add.NewEntry
local newAdd = newEnt.Add
local newCancel = newEnt.Cancel
local newId = newEnt.ID
local newName = newEnt.Nameb
local newMaterial = newEnt.Material
local newReflectance = newEnt.Reflectance
local newColor = newEnt.Color
local selectedEntry
local selectedValue
local selectedInd
local function populate()
tab:ClearAllChildren()
local newm = 0
for k,m in pairs(v) do
local new = Entry:Clone()
new.Text = "Name: "..m.Name.." | Texture: "..(m.ID or "N/A").." | Color: "..(m.Color or "N/A").." | Material: "..(m.Material or "N/A").." | Reflectance: "..(m.Reflectance or "N/A")
new.Position = UDim2.new(0,0,0,newm*20)
new.Visible = true
new.ZIndex = 2
new.Parent = tab
new.MouseButton1Click:connect(function()
if selectedEntry then
selectedEntry.BackgroundTransparency = 1
end
new.BackgroundTransparency = 0
selectedEntry = new
selectedValue = m
selectedInd = k
end)
newm=newm+1
end
tab.CanvasSize = UDim2.new(0,0,0,newm*20)
end
newAdd.MouseButton1Click:connect(function()
if newName.Text~="" then
local name = newName.Text
local id = newId.Text
local material = newMaterial.Text
local color = newColor.Text
local reflectance = newReflectance.Text
newName.Text = ""
newId.Text = ""
newMaterial.Text = ""
newColor.Text = ""
newReflectance.Text = ""
if material=="" then
material = nil
end
if color=="" then
color = nil
end
if id=="" then
id = nil
end
if reflectance=="" then
reflectance = nil
end
table.insert(sets[set],{Name=name,ID=id,Color=color,Material=material,Reflectance=reflectance})
client.Remote.Send("SaveTableAdd",set,{Name=name,ID=id,Color=color,Material=material,Reflectance=reflectance})
newEnt.Visible = false
populate()
end
end)
newCancel.MouseButton1Click:connect(function()
newName.Text = ""
newId.Text = ""
newMaterial.Text = ""
newColor.Text = ""
newReflectance.Text = ""
newEnt.Visible = false
end)
Remove.MouseButton1Click:connect(function()
if selectedEntry and selectedValue and selectedInd then
table.remove(sets[set],selectedInd)
client.Remote.Send("SaveTableRemove",set,selectedValue)
populate()
end
end)
Add.MouseButton1Click:connect(function()
newName.Text = ""
newId.Text = ""
newMaterial.Text = ""
newColor.Text = ""
newReflectance.Text = ""
if newEnt.Visible then
newEnt.Visible = false
else
newEnt.Visible = true
end
end)
Close.MouseButton1Click:connect(function()
newEnt.Visible = false
Capes.Visible = false
end)
clone.TextButton.MouseButton1Click:connect(function()
closeAll()
if Capes.Visible then
Capes.Visible = false
else
Capes.Visible = true
end
end)
populate()
elseif set=="CommandPermissions" then
local Perms = settingsTab.Permissions:clone()
Perms.Parent = settingsTab
local tab = Perms.Table
local Add = Perms.Add
local Close = Perms.Close
local Entry = Perms.Entry
local Remove = Perms.Removeb
local newEnt = Add.NewEntry
local newAdd = newEnt.Add
local newCancel = newEnt.Cancel
local newCommand = newEnt.Command
local newLevel = newEnt.Level
local selectedEntry
local selectedValue
local selectedInd
local function populate()
tab:ClearAllChildren()
local newm = 0
for k,m in pairs(v) do
local new = Entry:Clone()
new.Text = "Command: "..m.Command.." | Level: "..m.Level
new.Position = UDim2.new(0,0,0,newm*20)
new.Visible = true
new.ZIndex = 2
new.Parent = tab
new.MouseButton1Click:connect(function()
if selectedEntry then
selectedEntry.BackgroundTransparency = 1
end
new.BackgroundTransparency = 0
selectedEntry = new
selectedValue = m
selectedInd = k
end)
newm=newm+1
end
tab.CanvasSize = UDim2.new(0,0,0,newm*20)
end
newAdd.MouseButton1Click:connect(function()
if newCommand.Text~="" and newLevel.Text~="" then
local command = newCommand.Text
local level = newLevel.Text
newCommand.Text = ""
newLevel.Text = ""
table.insert(sets[set],{Command=command,Level=level})
client.Remote.Send("SaveTableAdd",set,{Command=command,Level=level})
newEnt.Visible = false
populate()
end
end)
newCancel.MouseButton1Click:connect(function()
newCommand.Text = ""
newLevel.Text = ""
newEnt.Visible = false
end)
Remove.MouseButton1Click:connect(function()
if selectedEntry and selectedValue and selectedInd then
table.remove(sets[i],selectedInd)
client.Remote.Send("SaveTableRemove",set,selectedValue)
populate()
end
end)
Add.MouseButton1Click:connect(function()
newCommand.Text = ""
newLevel.Text = ""
if newEnt.Visible then
newEnt.Visible = false
else
newEnt.Visible = true
end
end)
Close.MouseButton1Click:connect(function()
newEnt.Visible = false
Perms.Visible = false
end)
clone.TextButton.MouseButton1Click:connect(function()
closeAll()
if Perms.Visible then
Perms.Visible = false
else
Perms.Visible = true
end
end)
populate()
elseif set=="Leaderstats" then
local Stats = settingsTab.Leaderstats:clone()
Stats.Parent = settingsTab
local tab = Stats.Table
local Add = Stats.Add
local Close = Stats.Close
local Entry = Stats.Entry
local Remove = Stats.Removeb
local newEnt = Add.NewEntry
local newAdd = newEnt.Add
local newCancel = newEnt.Cancel
local newStat = newEnt.Nameb
local newType = newEnt.Type
local newValue = newEnt.Value
local selectedEntry
local selectedValue
local selectedInd
local function populate()
tab:ClearAllChildren()
local newm = 0
for k,m in pairs(v) do
local new = Entry:Clone()
new.Text = "Name: "..m.Stat.." | Type: "..m.Type.." | Value: "..m.Value
new.Position = UDim2.new(0,0,0,newm*20)
new.Visible = true
new.ZIndex = 2
new.Parent = tab
new.MouseButton1Click:connect(function()
if selectedEntry then
selectedEntry.BackgroundTransparency = 1
end
new.BackgroundTransparency = 0
selectedEntry = new
selectedValue = m
selectedInd = k
end)
newm=newm+1
end
tab.CanvasSize = UDim2.new(0,0,0,newm*20)
end
newAdd.MouseButton1Click:connect(function()
if newStat.Text~="" and newType.Text~="" then
local stat = newStat.Text
local type = newType.Text
local value = newValue.Text
newStat.Text = ""
newType.Text = ""
newValue.Text = ""
if type=="" then
type="String"
end
table.insert(sets[set],{Stat=stat,Type=type,Value=value})
client.Remote.Send("SaveTableAdd",set,{Stat=stat,Type=type,Value=value})
newEnt.Visible = false
populate()
end
end)
newCancel.MouseButton1Click:connect(function()
newStat.Text = ""
newType.Text = ""
newValue.Text = ""
newEnt.Visible = false
end)
Remove.MouseButton1Click:connect(function()
if selectedEntry and selectedValue and selectedInd then
table.remove(sets[set],selectedInd)
client.Remote.Send("SaveTableRemove",set,selectedValue)
populate()
end
end)
Add.MouseButton1Click:connect(function()
newStat.Text = ""
newType.Text = ""
newValue.Text = ""
if newEnt.Visible then
newEnt.Visible = false
else
newEnt.Visible = true
end
end)
Close.MouseButton1Click:connect(function()
newEnt.Visible = false
Stats.Visible = false
end)
clone.TextButton.MouseButton1Click:connect(function()
closeAll()
if Stats.Visible then
Stats.Visible = false
else
Stats.Visible = true
end
end)
populate()
else
local Normal = settingsTab.Normal:clone()
Normal.Parent = settingsTab
local tab = Normal.Table
local Add = Normal.Add
local Close = Normal.Close
local Entry = Normal.Entry
local Remove = Normal.Removeb
local newEnt = Add.NewEntry
local newAdd = newEnt.Add
local newCancel = newEnt.Cancel
local newValue = newEnt.Value
local selectedEntry
local selectedValue
local selectedInd
local function populate()
tab:ClearAllChildren()
local newm = 0
for k,m in pairs(v) do
local new = Entry:Clone()
new.Text = tostring(m)
new.Position = UDim2.new(0,0,0,newm*20)
new.Visible = true
new.ZIndex = 2
new.Parent = tab
new.MouseButton1Click:connect(function()
if selectedEntry then
selectedEntry.BackgroundTransparency = 1
end
new.BackgroundTransparency = 0
selectedEntry = new
selectedValue = m
selectedInd = k
end)
newm=newm+1
end
tab.CanvasSize = UDim2.new(0,0,0,newm*20)
end
newAdd.MouseButton1Click:connect(function()
if newValue.Text~="" then
local value = newValue.Text
newValue.Text = ""
table.insert(sets[set],value)
client.Remote.Send("SaveTableAdd",set,value)
newEnt.Visible = false
populate()
end
end)
newCancel.MouseButton1Click:connect(function()
newValue.Text = ""
newEnt.Visible = false
end)
Remove.MouseButton1Click:connect(function()
if selectedEntry and selectedValue and selectedInd then
table.remove(sets[set],selectedInd)
client.Remote.Send("SaveTableRemove",set,selectedValue)
populate()
end
end)
Add.MouseButton1Click:connect(function()
if newEnt.Visible then
newEnt.Visible = false
else
newEnt.Visible = true
end
end)
Close.MouseButton1Click:connect(function()
newEnt.Visible = false
Normal.Visible = false
end)
clone.TextButton.MouseButton1Click:connect(function()
closeAll()
if Normal.Visible then
Normal.Visible = false
else
Normal.Visible = true
end
end)
populate()
end
clone.Parent = settingsTab.Settings
num = num+1
end
settingsTab.Settings.CanvasSize = UDim2.new(0,0,0,num*20)
end
end
else
settings.Visible = false
end
end
|
--[[**
ensures value is an integer
@param value The value to check against
@returns True iff the condition is satisfied, false otherwise
**--]] |
function t.integer(value)
local success, errMsg = t.number(value)
if not success then
return false, errMsg or ""
end
if value%1 == 0 then
return true
else
return false, string.format("integer expected, got %s", value)
end
end
|
-- ROBLOX deviation: omitted fileExists and cleanup |
local function toMatchSnapshot(...)
local args = { ... }
local this: types.Context = args[1]
local received: any = args[2]
local propertiesOrHint: any = args[3]
local hint: ConfigPath = args[4]
local matcherName = "toMatchSnapshot"
local properties
local length = select("#", ...)
-- ROBLOX deviation: all the length parameters are one more than upstream because
-- the this parameter isn't counted in upstream
if length == 3 and typeof(propertiesOrHint) == "string" then
hint = propertiesOrHint
elseif length >= 3 then
if typeof(propertiesOrHint) ~= "table" or typeof(propertiesOrHint) == nil then
local options: JestMatcherUtils.MatcherHintOptions = {
isNot = this.isNot,
promise = this.promise,
}
local printedWithType = printWithType("Expected properties", propertiesOrHint, printExpected)
if length == 4 then
options.secondArgument = "hint"
options.secondArgumentColor = BOLD_WEIGHT
if propertiesOrHint == nil then
printedWithType = printedWithType
.. "\n\nTo provide a hint without properties: toMatchSnapshot('hint')"
end
end
error(AssertionError.new({
message = matcherErrorMessage(
matcherHint(matcherName, nil, PROPERTIES_ARG, options),
"Expected " .. EXPECTED_COLOR("properties") .. " must be an object",
printedWithType
),
}))
end
-- Future breaking change: Snapshot hint must be a string
-- if (arguments.length === 3 && typeof hint !== 'string') {}
properties = propertiesOrHint
end
return _toMatchSnapshot({
context = this,
hint = hint,
isInline = false,
matcherName = matcherName,
properties = properties,
received = received,
})
end
|
-- Current UI layout |
local CurrentLayout;
function ChangeLayout(Layout)
-- Sets the UI to the given layout
-- Make sure the new layout isn't already set
if CurrentLayout == Layout then
return;
end;
-- Set this as the current layout
CurrentLayout = Layout;
-- Reset the UI
for _, ElementName in pairs(UIElements) do
local Element = UI[ElementName];
Element.Visible = false;
end;
-- Keep track of the total vertical extents of all items
local Sum = 0;
-- Go through each layout element
for ItemIndex, ItemName in ipairs(Layout) do
local Item = UI[ItemName];
-- Make the item visible
Item.Visible = true;
-- Position this item underneath the past items
Item.Position = UDim2.new(0, 0, 0, 20) + UDim2.new(
Item.Position.X.Scale,
Item.Position.X.Offset,
0,
Sum + 10
);
-- Update the sum of item heights
Sum = Sum + 10 + Item.AbsoluteSize.Y;
end;
-- Resize the container to fit the new layout
UI.Size = UDim2.new(0, 200, 0, 40 + Sum);
end;
function UpdateUI()
-- Updates information on the UI
-- Make sure the UI's on
if not UI then
return;
end;
-- References to inputs
local TransparencyInput = UI.TransparencyOption.Input.TextBox;
local ReflectanceInput = UI.ReflectanceOption.Input.TextBox;
-----------------------
-- Update the UI layout
-----------------------
-- Figure out the necessary UI layout
if #Selection.Parts == 0 then
ChangeLayout(Layouts.EmptySelection);
return;
-- When the selection isn't empty
else
ChangeLayout(Layouts.Normal);
end;
-- Get the common properties
local Material = Support.IdentifyCommonProperty(Selection.Parts, 'Material');
local Transparency = Support.IdentifyCommonProperty(Selection.Parts, 'Transparency');
local Reflectance = Support.IdentifyCommonProperty(Selection.Parts, 'Reflectance');
-- Update the material dropdown
MaterialDropdown.SetOption(Material and Materials[Material] or '*');
-- Update inputs
UpdateDataInputs {
[TransparencyInput] = Transparency and Support.Round(Transparency, 2) or '*';
[ReflectanceInput] = Reflectance and Support.Round(Reflectance, 2) or '*';
};
end;
function TrackChange()
-- Start the record
HistoryRecord = {
Before = {};
After = {};
Selection = Selection.Items;
Unapply = function (Record)
-- Reverts this change
-- Select the changed parts
Selection.Replace(Record.Selection)
-- Send the change request
Core.SyncAPI:Invoke('SyncMaterial', Record.Before);
end;
Apply = function (Record)
-- Applies this change
-- Select the changed parts
Selection.Replace(Record.Selection)
-- Send the change request
Core.SyncAPI:Invoke('SyncMaterial', 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('SyncMaterial', HistoryRecord.After);
-- Register the record and clear the staging
Core.History.Add(HistoryRecord);
HistoryRecord = nil;
end;
|
--model.Part.Touched:Connect(function(player) |
wait(10)
if triggered==false then
triggered=true
leftTweenOpen:Play()
rightTweenOpen:Play()
model.Part.DoorStart:Play()
wait(4)
model.Part.DoorStart:Stop()
model.Part.DoorStop:Play()
wait(7.5)
--leftTweenClose:Play()
--rightTweenClose:Play()
--model.Part.DoorStart:Play()
--wait(4)
--model.Part.DoorStart:Stop()
--model.Part.DoorStop:Play()
--model.Part.DoorHit:Play()
--wait(0.1)
--triggered=false
script.Enabled = false
end |
--[=[
@param ... any
@return args: table
Serializes the arguments and returns the serialized values in a table.
]=] |
function Ser.SerializeArgs(...: any): Args
local args = table.pack(...)
for i,arg in ipairs(args) do
if type(arg) == "table" then
local ser = Ser.Classes[arg.ClassName]
if ser then
args[i] = ser.Serialize(arg)
end
end
end
return args
end
|
--doEvent() |
print(lowered)
return
end
function raise()
print("raising")
repeat
wait()
for i = 1, #a do
if a[i].className == "Part" then
if a[i].Mesh.Offset.Y < .5 then
a[i].Mesh.Offset = a[i].Mesh.Offset + Vector3.new(0, .01, 0)
end
end
end
until(script.Parent.Bar.Mesh.Offset.Y >= .5)
lowered = false |
--- Drag this into "StarterCharacterScripts" |
function OnDeath()
for _,p in pairs(game.Players:GetPlayers()) do
local Gui = script.DNGui:Clone()
Gui.Parent = p.PlayerGui
Gui.TextLabel.Text = script.Parent.Name.. " was killed."
Gui.Script.Disabled = false
end
end
script.Parent.Humanoid.Died:Connect(OnDeath)
|
-- print("1!!!",hum.Health) |
if hum.Health<1 then return end
end
if hit.Parent:findFirstChild("Humanoid2") ~= nil then
local hum=hit.Parent:findFirstChild("Humanoid2") |
--------------------------------------------------- |
function module:CreateRanks()
coroutine.wrap(function()
local ranksInfo = main.signals.RetrieveRanksInfo:InvokeServer()
local permRanksInfo = ranksInfo.PermRanks
local ranksToSort = ranksInfo.Ranks
local permissions = ranksInfo.Permissions
--Organise ranks
local rankPositions = {}
local ranks = {}
for i, rankDetails in pairs(ranksToSort) do
local rankId = rankDetails[1]
local rankName = rankDetails[2]
table.insert(ranks, 1, {rankId, rankName, {}})
end
for i,v in pairs(ranks) do
rankPositions[v[1]] = i
end
for pName, pDetails in pairs(permissions) do
--Owner
if pName == "owner" and rankPositions[5] then
local ownerRankDetail = ranks[rankPositions[5]]
table.insert(ownerRankDetail[3], {main.ownerName, "Owner", main:GetModule("cf"):GetUserImage(main.ownerId)})
--SpecificUsers and PermRanks
elseif pName == "specificusers" then
for plrName, rankId in pairs(pDetails) do
if #plrName > 1 then
local rankDetail = ranks[rankPositions[rankId]]
local boxInfo = {plrName, "Specific User", main:GetModule("cf"):GetUserImage(main:GetModule("cf"):GetUserId(plrName))}
table.insert(rankDetail[3], boxInfo)
end
end
for i, record in pairs(permRanksInfo) do
if not record.RemoveRank then
local rankDetail = ranks[rankPositions[record.Rank]]
if rankDetail then
local boxInfo = {main:GetModule("cf"):GetName(record.UserId), "PermRank", main:GetModule("cf"):GetUserImage(record.UserId), record}
table.insert(rankDetail[3], boxInfo)
end
end
end
elseif pName == "gamepasses" then
--Gamepasses
for gamepassId, gamepassInfo in pairs(pDetails) do
if not main:GetModule("cf"):FindValue(main.products, gamepassId) then
local rankDetail = ranks[rankPositions[gamepassInfo.Rank]]
if rankDetail then
local boxInfo = {gamepassInfo.Name, "Gamepass", gamepassInfo.IconImageAssetId, tonumber(gamepassId), gamepassInfo.PriceInRobux}
table.insert(rankDetail[3], boxInfo)
end
end
end
elseif pName == "assets" then
--Assets
for assetId, assetInfo in pairs(pDetails) do
local rankDetail = ranks[rankPositions[assetInfo.Rank]]
if rankDetail then
local boxInfo = {assetInfo.Name, "Asset", main:GetModule("cf"):GetAssetImage(assetId), tonumber(assetId), assetInfo.PriceInRobux}
table.insert(rankDetail[3], boxInfo)
end
end
elseif pName == "groups" then
--Groups
for groupId, groupInfo in pairs(pDetails) do
for roleName, roleInfo in pairs(groupInfo.Roles) do
if roleInfo.Rank then
local rankDetail = ranks[rankPositions[roleInfo.Rank]]
if rankDetail then
local boxInfo = {groupInfo.Name.." | "..roleName, "Group", groupInfo.EmblemUrl, tonumber(groupId)}
table.insert(rankDetail[3], boxInfo)
end
end
end
end
elseif otherPermissions[pName] then
--Other
local info = otherPermissions[pName]
local rank = permissions[info[1]]
if rank > 0 then
local rankDetail = ranks[rankPositions[rank]]
if rankDetail then
local boxInfo = {info[2], info[3], string.upper(string.sub(info[1], 1, 1))}
table.insert(rankDetail[3], boxInfo)
end
end
end
end
--Can view PermRank menu
local canModifyPermRanks = false
if main.pdata.Rank >= (main.commandRanks.permrank or 4) then
canModifyPermRanks = true
end
--Clear labels
main:GetModule("cf"):ClearPage(pages.ranks)
--Setup labels
local labelCount = 0
for i,v in pairs(ranks) do
local rankId = v[1]
local rankName = v[2]
local boxes = v[3]
--
labelCount = labelCount + 1
local rankTitle = templates.rankTitle:Clone()
rankTitle.Name = "Label".. labelCount
rankTitle.RankIdFrame.TextLabel.Text = rankId
rankTitle.RankName.Text = rankName
rankTitle.Visible = true
rankTitle.Parent = pages.ranks
--
for _, boxInfo in pairs(boxes) do
labelCount = labelCount + 1
local boxTitle = boxInfo[1]
local boxDesc = boxInfo[2]
local boxImage = boxInfo[3]
local rankItem = templates.rankItem:Clone()
rankItem.Name = "Label".. labelCount
rankItem.ItemTitle.Text = boxTitle
rankItem.ItemDesc.Text = boxDesc
if #tostring(boxImage) == 1 then
rankItem.ItemIcon.Text = boxImage
rankItem.ItemIcon.Visible = true
rankItem.ItemImage.Visible = false
else
if tonumber(boxImage) then
boxImage = "rbxassetid://"..boxImage
end
rankItem.ItemImage.Image = tostring(boxImage)
end
local xScale = 0.7
rankItem.Unlock.Visible = false
rankItem.ViewMore.Visible = false
if boxDesc == "Gamepass" or boxDesc == "Asset" then
local productId = boxInfo[4]
local productPrice = boxInfo[5]
rankItem.ItemImage.BackgroundTransparency = 1
rankItem.Unlock.Visible = true
rankItem.Unlock.MouseButton1Down:Connect(function()
buyFrame.ProductName.Text = boxTitle
buyFrame.ProductImage.Image = boxImage
buyFrame.PurchaseToUnlock.TextLabel.Text = rankName
buyFrame.InGame.TextLabel.Text = main.gameName
buyFrame.MainButton.Price.Text = (productPrice or 0).." "
buyFrame.MainButton.ProductId.Value = productId
buyFrame.MainButton.ProductType.Value = boxDesc
main:GetModule("cf"):ShowWarning("BuyFrame")
end)
xScale = 0.4
elseif boxDesc == "PermRank" then
local record = boxInfo[4]
if canModifyPermRanks then
local viewMore = rankItem.ViewMore
viewMore.Visible = true
viewMore.MouseButton1Down:Connect(function()
main:GetModule("cf"):ShowPermRankedUser{boxTitle, record.UserId, record.RankedBy}
end)
end
xScale = 0.6
else
xScale = 0.7
end
rankItem.ItemTitle.Size = UDim2.new(xScale, 0, rankItem.ItemTitle.Size.Y.Scale, 0)
rankItem.ItemDesc.Size = UDim2.new(xScale, 0, rankItem.ItemDesc.Size.Y.Scale, 0)
rankItem.Visible = true
rankItem.Parent = pages.ranks
end
end
--Canvas Size
if labelCount >= 2 then
for i = 1,2 do
local firstLabel = pages.ranks["Label1"]
local finalLabel = pages.ranks["Label".. labelCount]
pages.ranks.CanvasSize = UDim2.new(0, 0, 0, (finalLabel.AbsolutePosition.Y + finalLabel.AbsoluteSize.Y - firstLabel.AbsolutePosition.Y))
end
end
end)()
end
|
-- Testing AC FE support |
local event = script.Parent
local car=script.Parent.Parent
local LichtNum = 0
event.OnServerEvent:connect(function(player,data)
if data['ToggleLight'] then
if car.Body.Light.on.Value==true then
car.Body.Light.on.Value=false
else
car.Body.Light.on.Value=true
end
elseif data['EnableBrakes'] then
car.Body.Brakes.on.Value=true
elseif data['DisableBrakes'] then
car.Body.Brakes.on.Value=false
elseif data['ToggleLeftBlink'] then
if car.Body.Left.on.Value==true then
car.Body.Left.on.Value=false
else
car.Body.Left.on.Value=true
end
elseif data['ToggleRightBlink'] then
if car.Body.Right.on.Value==true then
car.Body.Right.on.Value=false
else
car.Body.Right.on.Value=true
end
elseif data['ReverseOn'] then
car.Body.Reverse.on.Value=true
elseif data['ReverseOff'] then
car.Body.Reverse.on.Value=false
elseif data['ToggleStandlicht'] then
if LichtNum == 0 then
LichtNum = 2
car.Body.Headlight.on.Value = true
elseif LichtNum == 1 then
LichtNum = 2
car.Body.Headlight.on.Value = true
elseif LichtNum == 2 then
LichtNum = 3
car.Body.Highlight.on.Value = true
elseif LichtNum == 3 then
LichtNum = 1
car.Body.Highlight.on.Value = false
car.Body.Headlight.on.Value = false
end
elseif data["ToggleHazards"] then
if car.Body.hazards.Value == false then
car.Body.hazards.Value = true
car.Body.Left.on.Value=false
car.Body.Right.on.Value=false
car.Body.Left.on.Value=true
car.Body.Right.on.Value=true
elseif car.Body.hazards.Value == true then
car.Body.hazards.Value = false
car.Body.Left.on.Value=false
car.Body.Right.on.Value=false
end
end
end)
|
-- K is a tunable parameter that changes the shape of the S-curve
-- the larger K is the more straight/linear the curve gets |
local k = 0.35
local lowerK = 0.8
local function SCurveTranform(t: number)
t = math.clamp(t, -1, 1)
if t >= 0 then
return (k*t) / (k - t + 1)
end
return -((lowerK*-t) / (lowerK + t + 1))
end
local DEADZONE = 0.1
local function toSCurveSpace(t: number)
return (1 + DEADZONE) * (2*math.abs(t) - 1) - DEADZONE
end
local function fromSCurveSpace(t: number)
return t/2 + 0.5
end
function CameraUtils.GamepadLinearToCurve(thumbstickPosition: Vector2)
local function onAxis(axisValue)
local sign = 1
if axisValue < 0 then
sign = -1
end
local point = fromSCurveSpace(SCurveTranform(toSCurveSpace(math.abs(axisValue))))
point = point * sign
return math.clamp(point, -1, 1)
end
return Vector2.new(onAxis(thumbstickPosition.X), onAxis(thumbstickPosition.Y))
end
|
--// # key, ManOff |
mouse.KeyUp:connect(function(key)
if key=="h" then
veh.Lightbar.middle.Man:Stop()
veh.Lightbar.middle.Wail.Volume = 10
veh.Lightbar.middle.Yelp.Volume = 10
veh.Lightbar.middle.Priority.Volume = 10
script.Parent.Parent.Sirens.Man.BackgroundColor3 = Color3.fromRGB(62, 62, 62)
veh.Lightbar.MANUAL.Transparency = 1
end
end)
|
--//Server Animations |
RightHighReady = CFrame.new(-.815, 0.55, -1.1) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(0));
LeftHighReady = CFrame.new(.815,0.55,-1.15) * CFrame.Angles(math.rad(-90),math.rad(0),math.rad(0));
RightLowReady = CFrame.new(-.815, 0.55, -1.1) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(0));
LeftLowReady = CFrame.new(.815,0.55,-1.15) * CFrame.Angles(math.rad(-90),math.rad(0),math.rad(0));
RightPatrol = CFrame.new(-.815, 0.55, -1.1) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(0));
LeftPatrol = CFrame.new(.815,0.55,-1.15) * CFrame.Angles(math.rad(-90),math.rad(0),math.rad(0));
RightAim = CFrame.new(-.815, 0.55, -1.1) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(0));
LeftAim = CFrame.new(.815,0.55,-1.15) * CFrame.Angles(math.rad(-90),math.rad(0),math.rad(0));
RightSprint = CFrame.new(-.815, 0.55, -1.1) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(0));
LeftSprint = CFrame.new(.815,0.55,-1.15) * CFrame.Angles(math.rad(-90),math.rad(0),math.rad(0));
ShootPos = CFrame.new(0,0,.25);
}
return module
|
--// SS3 controls for AC6 by Itzt, originally for 2014 Infiniti QX80. i don't know how to tune ac lol |
wait(0.1)
local player = game.Players.LocalPlayer
local HUB = script.Parent.HUB
local limitButton = HUB.Name
local FE = game.Workspace.FilteringEnabled
local lightOn = false
local Camera = game.Workspace.CurrentCamera
local cam = script.Parent.nxtcam.Value
local carSeat = script.Parent.CarSeat.Value
local mouse = game.Players.LocalPlayer:GetMouse()
local windows = false
local handler = carSeat:WaitForChild('Filter')
local winfob = HUB.Parent.Music
local pal = false
local palpal = HUB.Parent.Palette
local red = 0
local green = 0
local blue = 1
local debounce = false
|
--[[
CameraModule - This ModuleScript implements a singleton class to manage the
selection, activation, and deactivation of the current camera controller,
character occlusion controller, and transparency controller. This script binds to
RenderStepped at Camera priority and calls the Update() methods on the active
controller instances.
The camera controller ModuleScripts implement classes which are instantiated and
activated as-needed, they are no longer all instantiated up front as they were in
the previous generation of PlayerScripts.
2018 PlayerScripts Update - AllYourBlox
--]] |
local CameraModule = {}
CameraModule.__index = CameraModule
local FFlagUserRemoveTheCameraApi do
local success, result = pcall(function()
return UserSettings():IsUserFeatureEnabled("UserRemoveTheCameraApi")
end)
FFlagUserRemoveTheCameraApi = success and result
end
local FFlagUserFixCameraSelectModuleWarning do
local success, result = pcall(function()
return UserSettings():IsUserFeatureEnabled("UserFixCameraSelectModuleWarning")
end)
FFlagUserFixCameraSelectModuleWarning = success and result
end
local FFlagUserFlagEnableNewVRSystem do
local success, result = pcall(function()
return UserSettings():IsUserFeatureEnabled("UserFlagEnableNewVRSystem")
end)
FFlagUserFlagEnableNewVRSystem = success and result
end
|
-- Responsible for regening a player's humanoid's health | |
--[[
The following represents a raycast function suitable for guns.
The ray passes through all CanCollide = false parts unless they belong to a Humanoid.
--]] |
local Utils = require(script.Parent.Parent);
local FindCharacterAncestor = Utils.Misc.GetCharacterFromPart;
function Raycast(lookRay, ignoreList)
ignoreList = ignoreList or {};
local target, point, normal, targetCharacter;
repeat
target, point, normal = workspace:FindPartOnRayWithIgnoreList(lookRay, ignoreList);
targetCharacter = FindCharacterAncestor(target);
if target and not target.CanCollide and not targetCharacter then
table.insert(ignoreList, target);
target = nil;
else
return target, point, normal;
end
until target;
end
return Raycast;
|
-- Called when character is about to be removed |
function BaseOcclusion:CharacterRemoving(char: Model, player: Player)
end
function BaseOcclusion:OnCameraSubjectChanged(newSubject)
end
|
-- We want to be able to override outputFunction in tests, so the shape of this
-- module is kind of unconventional.
--
-- We fix it this weird shape in init.lua. |
local prettyPrint = require(script.Parent.prettyPrint)
local loggerMiddleware = {
outputFunction = print,
}
function loggerMiddleware.middleware(nextDispatch, store)
return function(action)
local result = nextDispatch(action)
loggerMiddleware.outputFunction(("Action dispatched: %s\nState changed to: %s"):format(
prettyPrint(action),
prettyPrint(store:getState())
))
return result
end
end
return loggerMiddleware
|
------------------------- |
function onClicked()
R.Function1.Disabled = true
FX.ROLL.BrickColor = BrickColor.new("CGA brown")
FX.ROLL.loop.Disabled = true
FX.REVERB.BrickColor = BrickColor.new("CGA brown")
FX.REVERB.loop.Disabled = true
FX.GATE.BrickColor = BrickColor.new("CGA brown")
FX.GATE.loop.Disabled = true
FX.ECHO.BrickColor = BrickColor.new("CGA brown")
FX.ECHO.loop.Disabled = true
FX.SLIPROLL.BrickColor = BrickColor.new("CGA brown")
FX.SLIPROLL.loop.Disabled = true
FX.FILTER.BrickColor = BrickColor.new("CGA brown")
FX.FILTER.loop.Disabled = true
FX.SENDRETURN.BrickColor = BrickColor.new("Really red")
FX.SENDRETURN.loop.Disabled = true
FX.TRANS.BrickColor = BrickColor.new("CGA brown")
FX.TRANS.loop.Disabled = true
FX.MultiTapDelay.BrickColor = BrickColor.new("CGA brown")
FX.MultiTapDelay.loop.Disabled = true
FX.DELAY.BrickColor = BrickColor.new("CGA brown")
FX.DELAY.loop.Disabled = true
FX.REVROLL.BrickColor = BrickColor.new("CGA brown")
FX.REVROLL.loop.Disabled = true
R.loop.Disabled = false
R.Function2.Disabled = false
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
|
-- If promise debugging is on, use a version of pcall that warns on failure.
-- This is useful for finding errors that happen within Promise itself. |
local wpcall
if PROMISE_DEBUG then
wpcall = function(f, ...)
local result = { pcall(f, ...) }
if not result[1] then
warn(result[2])
end
return unpack(result)
end
else
wpcall = pcall
end
|
--[=[
@return Promise
Returns a promise that is resolved once Knit has started. This is useful
for any code that needs to tie into Knit services but is not the script
that called `Start`.
```lua
Knit.OnStart():andThen(function()
local MyService = Knit.Services.MyService
MyService:DoSomething()
end):catch(warn)
```
]=] |
function KnitServer.OnStart()
if startedComplete then
return Promise.resolve()
else
return Promise.fromEvent(onStartedComplete.Event)
end
end
return KnitServer
|
-- Decompiled with the Synapse X Luau decompiler. |
local v1 = {};
local v2 = require(game.ReplicatedStorage.Modules.Lightning);
local v3 = require(game.ReplicatedStorage.Modules.Xeno);
local v4 = require(game.ReplicatedStorage.Modules.CameraShaker);
local l__TweenService__5 = game.TweenService;
local l__Debris__6 = game.Debris;
local l__ReplicatedStorage__1 = game.ReplicatedStorage;
function v1.RunStompFx(p1, p2, p3, p4)
local v7 = l__ReplicatedStorage__1.KillFX[p1].Second:Clone();
v7.Parent = p2.Parent.UpperTorso and p2;
v7:Play();
game.Debris:AddItem(v7, 5);
local v8 = l__ReplicatedStorage__1.KillFX[p1].Stomp:Clone();
v8.Parent = p3.Character.UpperTorso and p2;
v8:Play();
game.Debris:AddItem(v8, 5);
l__ReplicatedStorage__1.KillFX[p1].Yes:Clone().Parent = p2.Parent.Head;
return nil;
end;
return v1;
|
-- This is an overloaded function for TransparencyController:SetupTransparency(character)
-- Do not call directly, or it will throw an assertion! |
function FpsCamera:SetupTransparency(character, ...)
assert(self ~= FpsCamera)
self:BaseSetupTransparency(character, ...)
if self.AttachmentListener then
self.AttachmentListener:Disconnect()
end
self.AttachmentListener = character.DescendantAdded:Connect(function (obj)
if obj:IsA("Attachment") and self.HeadAttachments[obj.Name] then
self.cachedParts[obj.Parent] = true
self.transparencyDirty = true
end
end)
end
|
-- Constants |
local DEBUG = false -- Whether or not to use debugging features of FastCast, such as cast visualization.
local BULLET_SPEED = 100 -- Studs/second - the speed of the bullet
local BULLET_MAXDIST = 1000 -- The furthest distance the bullet can travel
local BULLET_GRAVITY = Vector3.new(0, -workspace.Gravity, 0) -- The amount of gravity applied to the bullet in world space (so yes, you can have sideways gravity)
local MIN_BULLET_SPREAD_ANGLE = 1 -- THIS VALUE IS VERY SENSITIVE. Try to keep changes to it small. The least accurate the bullet can be. This angle value is in degrees. A value of 0 means straight forward. Generally you want to keep this at 0 so there's at least some chance of a 100% accurate shot.
local MAX_BULLET_SPREAD_ANGLE = 4 -- THIS VALUE IS VERY SENSITIVE. Try to keep changes to it small. The most accurate the bullet can be. This angle value is in degrees. A value of 0 means straight forward. This cannot be less than the value above. A value of 90 will allow the gun to shoot sideways at most, and a value of 180 will allow the gun to shoot backwards at most. Exceeding 180 will not add any more angular varience.
local FIRE_DELAY = 1 -- The amount of time that must pass after firing the gun before we can fire again.
local BULLETS_PER_SHOT = 1 -- The amount of bullets to fire every shot. Make this greater than 1 for a shotgun effect.
local PIERCE_DEMO = true -- True if the pierce demo should be used. See the CanRayPierce function for more info. |
-- Modified By GraphicsSettings, Original is unknown
-- Removed Unnessecary code and improved the syntax
-- Better than toObjectSpace? |
local Tool = script.Parent.Parent
local update = script.Parent:WaitForChild('Update')
local Neck_Original = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
local RS = game:GetService("RunService").RenderStepped
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:wait()
local Torso = Character:WaitForChild('Torso')
Tool.Unequipped:connect(function()
update:FireServer('Unequip')
end)
Tool.Equipped:connect(function(curr_mouse)
wait(.2)
curr_mouse.TargetFilter = workspace
while true do
if Tool.Parent.className ~= 'Model' then
break
end
update:FireServer('Turn', curr_mouse.Hit.p)
RS:wait()
end
end)
|
--// F key, Horn |
mouse.KeyUp:connect(function(key)
if key=="f" then
if Rumbler == false then
veh.Lightbar.middle.WailR.Volume = 0
veh.Lightbar.middle.YelpR.Volume = 0
veh.Lightbar.middle.PriorityR.Volume = 0
veh.Lightbar.middle.Wail.Volume = 1
veh.Lightbar.middle.Yelp.Volume = 1
veh.Lightbar.middle.Priority.Volume = 1
elseif Rumbler == true then
veh.Lightbar.middle.WailR.Volume = 1
veh.Lightbar.middle.YelpR.Volume = 1
veh.Lightbar.middle.PriorityR.Volume = 1
veh.Lightbar.middle.Wail.Volume = 0
veh.Lightbar.middle.Yelp.Volume = 0
veh.Lightbar.middle.Priority.Volume = 0
end
veh.Lightbar.middle.Airhorn:Stop()
end
end)
mouse.KeyDown:connect(function(key)
if key=="j" then
veh.Lightbar.middle.Beep:Play()
veh.Lightbar.RemoteEvent:FireServer(true)
end
end)
mouse.KeyDown:connect(function(key)
if key=="]" then
Rumbler=true
veh.Lightbar.middle.WailR.Volume = 1
veh.Lightbar.middle.YelpR.Volume = 1
veh.Lightbar.middle.PriorityR.Volume = 1
veh.Lightbar.middle.Wail.Volume = 0
veh.Lightbar.middle.Yelp.Volume = 0
veh.Lightbar.middle.Priority.Volume = 0
end
end)
mouse.KeyDown:connect(function(key)
if key=="[" then
Rumbler=false
veh.Lightbar.middle.WailR.Volume = 0
veh.Lightbar.middle.YelpR.Volume = 0
veh.Lightbar.middle.PriorityR.Volume = 0
veh.Lightbar.middle.Wail.Volume = 1
veh.Lightbar.middle.Yelp.Volume = 1
veh.Lightbar.middle.Priority.Volume = 1
end
end)
|
-- Decompiled with the Synapse X Luau decompiler. |
function Click()
script.Parent.ScrollingFrame.Visible = true;
script.Parent.CloseButton.Visible = true;
end;
script.Parent.MouseButton1Down:connect(Click);
|
-- child.C0 = CFrame.new(0,-0.6,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0) --// Reposition player |
if child.Part1.Name == "HumanoidRootPart" then
player = game.Players:GetPlayerFromCharacter(child.Part1.Parent)
if player and (not player.PlayerGui:FindFirstChild("Screen")) then --// The part after the "and" prevents multiple GUI's to be copied over.
GUI.CarSeat.Value = script.Parent --// Puts a reference of the seat in this ObjectValue, now you can use this ObjectValue's value to find the car directly.
GUI:Clone().Parent = player.PlayerGui --// Compact version
script.Parent.Parent.Body.Dash.Screen.G.Enabled = true
script.Parent.Parent.Body.Dash.DashSc.G.Enabled = true
--[[script.Parent.Parent.Body.Lights.Runners.A.Material = "Neon"
script.Parent.Parent.Body.Lights.Runners.B.Material = "Neon"]]
end
end
end
end)
script.Parent.ChildRemoved:connect(function(child)
if child:IsA("Weld") then
if child.Part1.Name == "HumanoidRootPart" then
game.Workspace.CurrentCamera.FieldOfView = 70
player = game.Players:GetPlayerFromCharacter(child.Part1.Parent)
if player and player.PlayerGui:FindFirstChild("SS3") then
player.PlayerGui:FindFirstChild("SS3"):Destroy()
script.Parent.Parent.Body.Dash.Screen.G.Enabled = false
script.Parent.Parent.Body.Dash.DashSc.G.Enabled = false
--[[script.Parent.Parent.Body.Lights.Runners.A.Material = "SmoothPlastic"
script.Parent.Parent.Body.Lights.Runners.B.Material = "SmoothPlastic"]]
end
end
end
end)
|
-- |
script.Parent:WaitForChild("A-Chassis Interface")
script.Parent:WaitForChild("Plugins")
script.Parent:WaitForChild("README")
local car=script.Parent.Parent
local _Tune=require(script.Parent)
local Drive=car.Wheels:GetChildren()
for _,v in pairs(Drive) do
for _,a in pairs({"Top","Bottom","Left","Right","Front","Back"}) do
v[a.."Surface"]=Enum.SurfaceType.SmoothNoOutlines
end
local WParts = {}
local tPos = v.Position-car.DriveSeat.Position
if v.Name=="FL" or v.Name=="RL" then
v.CFrame = car.DriveSeat.CFrame*CFrame.Angles(math.rad(90),0,math.rad(90))
else
v.CFrame = car.DriveSeat.CFrame*CFrame.Angles(math.rad(90),0,math.rad(-90))
end
v.CFrame = v.CFrame+tPos
if v:FindFirstChild("Parts")~=nil then
for _,a in pairs(v.Parts:GetChildren()) do
if a:IsA("BasePart") then
table.insert(WParts, {a,v.CFrame:toObjectSpace(a.CFrame)})
end
end
end
if v:FindFirstChild("Fixed")~=nil then
for _,a in pairs(v.Fixed:GetChildren()) do
if a:IsA("BasePart") then
table.insert(WParts, {a,v.CFrame:toObjectSpace(a.CFrame)})
end
end
end
if v.Name=="FL" or v.Name=="FR" then
v.CFrame = v.CFrame*CFrame.Angles(math.rad(_Tune.FCamber),0,0)
if v.Name=="FL" then
v.CFrame = v.CFrame*CFrame.Angles(0,math.rad(-_Tune.FCaster),math.rad(_Tune.FToe))
else
v.CFrame = v.CFrame*CFrame.Angles(0,math.rad(_Tune.FCaster),math.rad(-_Tune.FToe))
end
else
v.CFrame = v.CFrame*CFrame.Angles(math.rad(_Tune.RCamber),0,0)
if v.Name=="RL" then
v.CFrame = v.CFrame*CFrame.Angles(0,math.rad(-_Tune.RCaster),math.rad(_Tune.RToe))
else
v.CFrame = v.CFrame*CFrame.Angles(0,math.rad(_Tune.RCaster),math.rad(-_Tune.RToe))
end
end
for _,a in pairs(WParts) do
a[1].CFrame=v.CFrame:toWorldSpace(a[2])
end
local arm=Instance.new("Part",v)
arm.Name="Arm"
arm.Anchored=true
arm.CanCollide=false
arm.FormFactor=Enum.FormFactor.Custom
arm.Size=Vector3.new(1,1,1)
arm.CFrame=(v.CFrame*CFrame.new(0,_Tune.StAxisOffset,0))*CFrame.Angles(-math.pi/2,-math.pi/2,0)
arm.TopSurface=Enum.SurfaceType.Smooth
arm.BottomSurface=Enum.SurfaceType.Smooth
arm.Transparency=1
local base=arm:Clone()
base.Parent=v
base.Name="Base"
base.CFrame=base.CFrame*CFrame.new(0,1,0)
base.BottomSurface=Enum.SurfaceType.Hinge
local axle=arm:Clone()
axle.Parent=v
axle.Name="Axle"
axle.CFrame=CFrame.new(v.Position-((v.CFrame*CFrame.Angles(math.pi/2,0,0)).lookVector*((v.Size.x/2)+(axle.Size.x/2))),v.Position)*CFrame.Angles(0,math.pi,0)
axle.BackSurface=Enum.SurfaceType.Hinge
MakeWeld(car.DriveSeat,base)
if v.Parent.Name == "RL" or v.Parent.Name == "RR" then
MakeWeld(car.DriveSeat,arm)
end
MakeWeld(arm,axle)
arm:MakeJoints()
axle:MakeJoints()
if v:FindFirstChild("Fixed")~=nil then
ModelWeld(v.Fixed,axle)
end
if v:FindFirstChild("Parts")~=nil then
ModelWeld(v.Parts,v)
end
if v:FindFirstChild("Steer") then
v:FindFirstChild("Steer"):Destroy()
end
local gyro=Instance.new("BodyGyro",v)
gyro.Name="Stabilizer"
if v.Name=="FL" or v.Name=="FR" then
gyro.D=_Tune.FGyroD
gyro.MaxTorque=_Tune.FGyroMaxTorque
gyro.P=_Tune.FGyroP
else
gyro.D=_Tune.RGyroD
gyro.MaxTorque=_Tune.RGyroMaxTorque
gyro.P=_Tune.RGyroP
end
if v.Name=="FL" or v.Name=="FR" then
local steer=Instance.new("BodyGyro",arm)
steer.Name="Steer"
steer.P=_Tune.SteerP
steer.D=_Tune.SteerD
steer.MaxTorque=Vector3.new(0,_Tune.SteerMaxTorque,0)
steer.cframe=base.CFrame
else
MakeWeld(base,axle,"Weld")
end
local AV=Instance.new("BodyAngularVelocity",v)
AV.Name="#AV"
AV.angularvelocity=Vector3.new(0,0,0)
AV.maxTorque=Vector3.new(_Tune.PBrakeForce,0,_Tune.PBrakeForce)
AV.P=1e9
end
for i,v in pairs(script:GetChildren()) do
if v:IsA("ModuleScript") then
require(v)
end
end
wait()
ModelWeld(car.Body,car.DriveSeat)
local flipG = Instance.new("BodyGyro",car.DriveSeat)
flipG.Name = "Flip"
flipG.D = 0
flipG.MaxTorque = Vector3.new(0,0,0)
flipG.P = 0
wait()
UnAnchor(car)
script.Parent["A-Chassis Interface"].Car.Value=car
for i,v in pairs(script.Parent.Plugins:GetChildren()) do
for _,a in pairs(v:GetChildren()) do
if a:IsA("RemoteEvent") or v:IsA("RemoteFunction") then
a.Parent=car
for _,b in pairs(a:GetChildren()) do
if b:IsA("Script") then b.Disabled=false end
end
end
end
v.Parent = script.Parent["A-Chassis Interface"]
end
script.Parent.Plugins:Destroy()
car.DriveSeat.ChildAdded:connect(function(child)
if child.Name=="SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
local p=game.Players:GetPlayerFromCharacter(child.Part1.Parent)
car.DriveSeat:SetNetworkOwner(p)
local g=script.Parent["A-Chassis Interface"]:Clone()
g.Parent=p.PlayerGui
end
end)
car.DriveSeat.ChildRemoved:connect(function(child)
if child.Name=="SeatWeld" and child:IsA("Weld") then
for i,v in pairs(car.DriveSeat:GetChildren()) do
if v:IsA("Sound") then v:Stop() end
end
if car.DriveSeat:FindFirstChild("Flip")~=nil then
car.DriveSeat.Flip.MaxTorque = Vector3.new()
end
for i,v in pairs(car.Wheels:GetChildren()) do
if v:FindFirstChild("#AV")~=nil then
if v["#AV"].AngularVelocity.Magnitude>0 then
v["#AV"].AngularVelocity = Vector3.new()
v["#AV"].MaxTorque = Vector3.new()
end
end
end
end
end)
ver = require(script.Parent.README)
|
--Made by ?!?!?!?!, just group with the model to get it to work. This button also works for planes.
--Do not change anything besides the lines mentioned below.Again,Group it to anything you want(Cars,Trains,Planes Etc.) |
model = script.Parent.Parent--Indicates that the script interacts with the model the button is grouped with.
messageText = "Regenerating... "--If you want a message to appear upon pressing, type it here.
message = Instance.new("Message")
message.Text = messageText
backup = model:clone()
enabled = true
function regenerate()
message.Parent = game.Workspace
model:remove()
wait(3)--Change this number to display the regen message as long as you want in seconds.
model = backup:clone()
model.Parent = game.Workspace
model:makeJoints()
message.Parent = nil
script.Disabled = true
script.Parent.BrickColor = BrickColor.new(26)--Black
wait(10)--Change this number to change the time in between regenerations via the button, in seconds..
script.Parent.BrickColor = BrickColor.new(104)--Purple
script.Disabled = false
end
function onHit(hit)
if (hit.Parent:FindFirstChild("Humanoid") ~= nil) and enabled then
regenerate()
end
end
script.Parent.Touched:connect(onHit)
|
--Variable Setup
--Main Script |
door.DoorButton.ClickDetector.MouseClick:connect(function()
door.Door.Transparency = 1
door.Door.CanCollide = false
door.DoorButton.ClickDetector.MaxActivationDistance = 1
light.Light1.Light.PointLight.Enabled = true
light.Light1.Light.Transparency = 0
end)
door2.DoorButton.ClickDetector.MouseClick:connect(function()
door2.Door.Transparency = 1
door2.Door.CanCollide = false
light.Light2.Light.PointLight.Enabled = true
light.Light2.Light.Transparency = 0
end)
door3.DoorButton.ClickDetector.MouseClick:connect(function()
door3.Door.Transparency = 1
door3.Door.CanCollide = false
door3.DoorButton.ClickDetector.MaxActivationDistance = 1
light.Light3.Light.PointLight.Enabled = true
light.Light3.Light.Transparency = 0
end)
door4.DoorButton.ClickDetector.MouseClick:connect(function()
door4.Door.Transparency = 1
door4.Door.CanCollide = false
door4.DoorButton.ClickDetector.MaxActivationDistance = 1
light.Light4.Light.PointLight.Enabled = true
light.Light4.Light.Transparency = 0
end)
|
-- << RETRIEVE FRAMEWORK >> |
local main = _G.HDAdminMain
local load = main.loadModule
local cf = load("cf")
local credits = load("Credits")
local updates = load("Updates")
|
-- Put this script in a Part or a ServerScriptService |
local scriptToDestroy = game.Workspace.Map6.Badge.Nodead
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local humanoid = character:WaitForChild("Humanoid")
humanoid.Died:Connect(function()
scriptToDestroy:Destroy()
end)
end)
end)
|
-- // Constants \\ --
-- Services -- |
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")
|
------------------------- |
mouse.KeyDown:connect(function (key)
key = string.lower(key)
if key == "a" then
a = true
elseif key == "d" then
d = true
elseif key == "w" then
w = true
rwd.Throttle = 1
rwd.Torque = tq
lwd.Throttle = 1
lwd.Torque = ftq
rrwd.Throttle = 1
rrwd.Torque = ftq
rwd.MaxSpeed = 400
lwd.MaxSpeed = 400
rrwd.MaxSpeed = 400
carSeat.Throttle = 1
carSeat.Torque = 0
elseif key == "s" then
s = true
carSeat.Throttle = 0
carSeat.Torque = 0
rwd.Throttle = -1
rwd.Torque = brk
lwd.Throttle = -1
lwd.Torque = brk
rrwd.Throttle = -1
rrwd.Torque = brk
rwd.MaxSpeed = 25
lwd.MaxSpeed = 25
rrwd.MaxSpeed = 25
end
end)
mouse.KeyUp:connect(function (key)
key = string.lower(key)
if key == "a" then
print("a up")
if d == false then
m.DesiredAngle = 0
n.DesiredAngle = m.DesiredAngle
end
elseif key == "d" then
print("d up")
if a == false then
m.DesiredAngle = 0
n.DesiredAngle = m.DesiredAngle
end
end
a = false
d = false
end)
mouse.KeyUp:connect(function (key)
key = string.lower(key)
if key == "w" or key == "s" then
rwd.Throttle = 0
rwd.Torque = 0
lwd.Throttle = 0
lwd.Torque = 0
rrwd.Throttle = 0
rrwd.Torque = 0
carSeat.Throttle = 0
carSeat.Torque = cst
end
end)
limitButton.MouseButton1Click:connect(function() |
--// Ammo Settings |
Ammo = 10;
StoredAmmo = 1;
MagCount = math.huge; -- If you want infinate ammo, set to math.huge EX. MagCount = math.huge;
ExplosiveAmmo = 3;
|
--Mobile support |
local mobileGui = script.MobileGui
if userInputService.TouchEnabled then
userInputService.ModalEnabled = true
mobileGui.Parent = player.PlayerGui
mobileGui.DrivePad.Up.MouseButton1Down:connect(function()
movement = Vector2.new(movement.X, 1)
end)
mobileGui.DrivePad.Up.MouseButton1Up:connect(function()
movement = Vector2.new(movement.X, 0)
end)
mobileGui.DrivePad.Down.MouseButton1Down:connect(function()
movement = Vector2.new(movement.X, -1)
end)
mobileGui.DrivePad.Down.MouseButton1Up:connect(function()
movement = Vector2.new(movement.X, 0)
end)
mobileGui.TurnPad.Left.MouseButton1Down:connect(function()
movement = Vector2.new(-1, movement.Y)
end)
mobileGui.TurnPad.Left.MouseButton1Up:connect(function()
movement = Vector2.new(0, movement.Y)
end)
mobileGui.TurnPad.Right.MouseButton1Down:connect(function()
movement = Vector2.new(1, movement.Y)
end)
mobileGui.TurnPad.Right.MouseButton1Up:connect(function()
movement = Vector2.new(0, movement.Y)
end)
mobileGui.ExitButton.Text = "Exit " .. car.Name
mobileGui.ExitButton.MouseButton1Click:connect(function()
character.Humanoid.Jump = true
end)
else
mobileGui:Destroy()
end
|
--Made by Luckymaxer |
Figure = script.Parent
BasePart = Instance.new("Part")
BasePart.Material = Enum.Material.Plastic
BasePart.Shape = Enum.PartType.Block
BasePart.TopSurface = Enum.SurfaceType.Smooth
BasePart.BottomSurface = Enum.SurfaceType.Smooth
BasePart.FormFactor = Enum.FormFactor.Custom
BasePart.Size = Vector3.new(0.2, 0.2, 0.2)
BasePart.CanCollide = true
BasePart.Locked = true
BasePart.Anchored = false
Humanoid = Figure:WaitForChild("Humanoid")
Head = Figure:WaitForChild("Head")
Logo = Head:FindFirstChild("Logo")
Spawn(function()
if Logo then
Logo.Enabled = true
wait(5)
Logo.Enabled = false
end
end)
Humanoid.MaxHealth = 250
Humanoid.Health = Humanoid.MaxHealth
|
-- Modules |
local Data = ServerScriptService.Data
local Data_Modules = Data.Modules
local DataStore = require(Data_Modules.DataStore)
local ModuleScripts = ReplicatedStorage:WaitForChild("ModuleScripts")
local GameSettings = require(ModuleScripts:WaitForChild("GameSettings"))
|
--------RIGHT DOOR -------- |
game.Workspace.doorright.l53.BrickColor = BrickColor.new(1013)
game.Workspace.doorright.l32.BrickColor = BrickColor.new(106)
game.Workspace.doorright.pillar.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
|
--// Bullet Physics |
BulletPhysics = Vector3.new(0,55,0); -- Drop fixation: Lower number = more drop
BulletSpeed = 1500; -- Bullet Speed
BulletSpread = 0; -- How much spread the bullet has
ExploPhysics = Vector3.new(0,20,0); -- Drop for explosive rounds
ExploSpeed = 600; -- Speed for explosive rounds
BulletDecay = 1000000; -- How far the bullet travels before slowing down and being deleted (BUGGY)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.