prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
--use this to determine if you want this human to be harmed or not, returns boolean
|
function boom()
wait(2)
Used = true
Object.Anchored = true
Object.CanCollide = false
Object.Sparks.Enabled = false
Object.Orientation = Vector3.new(0,0,0)
Object.Transparency = 1
Object.Fuse:Stop()
Object.Explode:Play()
Object.Dist1:Play()
Object.Dist2:Play()
Object.Explosion:Emit(100)
Object.Smoke1:Emit(150)
Object.Smoke2:Emit(50)
Object.Smoke3:Emit(50)
Object.Debris:Emit(200)
Object.Debris2:Emit(900)
Object.Debris3:Emit(900)
Explode()
end
boom()
|
-- Request limit bookkeeping:
|
local Budgets = {}
local budgetRequestQueues = {
[Enum.DataStoreRequestType.GetAsync] = {};
[Enum.DataStoreRequestType.GetSortedAsync] = {};
[Enum.DataStoreRequestType.OnUpdate] = {};
[Enum.DataStoreRequestType.SetIncrementAsync] = {};
[Enum.DataStoreRequestType.SetIncrementSortedAsync] = {};
}
local function initBudget()
for requestType, const in pairs(ConstantsMapping) do
Budgets[requestType] = const.START
end
Budgets[Enum.DataStoreRequestType.UpdateAsync] = math.min(
Budgets[Enum.DataStoreRequestType.GetAsync],
Budgets[Enum.DataStoreRequestType.SetIncrementAsync]
)
end
local function updateBudget(req, const, dt, n)
if not Constants.BUDGETING_ENABLED then
return
end
local rate = const.RATE + n * const.RATE_PLR
Budgets[req] = math.min(
Budgets[req] + dt * rate,
const.MAX_FACTOR * rate
)
end
local function stealBudget(budget)
if not Constants.BUDGETING_ENABLED then
return
end
for _, requestType in pairs(budget) do
if Budgets[requestType] then
Budgets[requestType] = math.max(0, Budgets[requestType] - 1)
end
end
Budgets[Enum.DataStoreRequestType.UpdateAsync] = math.min(
Budgets[Enum.DataStoreRequestType.GetAsync],
Budgets[Enum.DataStoreRequestType.SetIncrementAsync]
)
end
local function checkBudget(budget)
if not Constants.BUDGETING_ENABLED then
return true
end
for _, requestType in pairs(budget) do
if Budgets[requestType] and Budgets[requestType] < 1 then
return false
end
end
return true
end
local isFrozen = false
if RunService:IsServer() then
-- Only do budget/throttle updating on server (in case package required on client)
initBudget()
coroutine.wrap(function() -- Thread that increases budgets and de-throttles requests periodically
local lastCheck = tick()
while Utils.accurateWait(Constants.BUDGET_UPDATE_INTERVAL) do
local now = tick()
local dt = (now - lastCheck) / 60
lastCheck = now
local n = #Players:GetPlayers()
if not isFrozen then
for requestType, const in pairs(ConstantsMapping) do
updateBudget(requestType, const, dt, n)
end
Budgets[Enum.DataStoreRequestType.UpdateAsync] = math.min(
Budgets[Enum.DataStoreRequestType.GetAsync],
Budgets[Enum.DataStoreRequestType.SetIncrementAsync]
)
end
for _, budgetRequestQueue in pairs(budgetRequestQueues) do
for i = #budgetRequestQueue, 1, -1 do
local request = budgetRequestQueue[i]
local thread = request.Thread
local budget = request.Budget
local key = request.Key
local lock = request.Lock
local cache = request.Cache
if not (lock and (lock[key] or tick() - (cache[key] or 0) < Constants.WRITE_COOLDOWN)) and checkBudget(budget) then
table.remove(budgetRequestQueue, i)
stealBudget(budget)
coroutine.resume(thread)
end
end
end
end
end)()
game:BindToClose(function()
for requestType, const in pairs(ConstantsMapping) do
Budgets[requestType] = math.max(
Budgets[requestType],
Constants.BUDGET_ONCLOSE_BASE * (const.RATE / Constants.BUDGET_BASE)
)
end
Budgets[Enum.DataStoreRequestType.UpdateAsync] = math.min(
Budgets[Enum.DataStoreRequestType.GetAsync],
Budgets[Enum.DataStoreRequestType.SetIncrementAsync]
)
end)
end
function MockDataStoreManager.GetGlobalData()
return Data.GlobalDataStore
end
function MockDataStoreManager.GetData(name, scope)
assert(type(name) == "string")
assert(type(scope) == "string")
if not Data.DataStore[name] then
Data.DataStore[name] = {}
end
if not Data.DataStore[name][scope] then
Data.DataStore[name][scope] = {}
end
return Data.DataStore[name][scope]
end
function MockDataStoreManager.GetOrderedData(name, scope)
assert(type(name) == "string")
assert(type(scope) == "string")
if not Data.OrderedDataStore[name] then
Data.OrderedDataStore[name] = {}
end
if not Data.OrderedDataStore[name][scope] then
Data.OrderedDataStore[name][scope] = {}
end
return Data.OrderedDataStore[name][scope]
end
function MockDataStoreManager.GetDataInterface(data)
return Interfaces[data]
end
function MockDataStoreManager.SetDataInterface(data, interface)
assert(type(data) == "table")
assert(type(interface) == "table")
Interfaces[data] = interface
end
function MockDataStoreManager.GetBudget(requestType)
if Constants.BUDGETING_ENABLED then
return math.floor(Budgets[requestType] or 0)
else
return math.huge
end
end
function MockDataStoreManager.SetBudget(requestType, budget)
assert(type(budget) == "number")
budget = math.max(budget, 0)
if requestType == Enum.DataStoreRequestType.UpdateAsync then
Budgets[Enum.DataStoreRequestType.SetIncrementAsync] = budget
Budgets[Enum.DataStoreRequestType.GetAsync] = budget
end
if Budgets[requestType] then
Budgets[requestType] = budget
end
end
function MockDataStoreManager.ResetBudget()
initBudget()
end
function MockDataStoreManager.FreezeBudgetUpdates()
isFrozen = true
end
function MockDataStoreManager.ThawBudgetUpdates()
isFrozen = false
end
function MockDataStoreManager.YieldForWriteLockAndBudget(callback, key, writeLock, writeCache, budget)
assert(type(callback) == "function")
assert(type(key) == "string")
assert(type(writeLock) == "table")
assert(type(writeCache) == "table")
assert(#budget > 0)
local mainRequestType = budget[1]
if #budgetRequestQueues[mainRequestType] >= Constants.THROTTLE_QUEUE_SIZE then
return false -- no room in throttle queue
end
callback() -- would i.e. trigger a warning in output
table.insert(budgetRequestQueues[mainRequestType], 1, {
Key = key;
Lock = writeLock;
Cache = writeCache;
Thread = coroutine.running();
Budget = budget;
})
coroutine.yield()
return true
end
function MockDataStoreManager.YieldForBudget(callback, budget)
assert(type(callback) == "function")
assert(#budget > 0)
local mainRequestType = budget[1]
if checkBudget(budget) then
stealBudget(budget)
elseif #budgetRequestQueues[mainRequestType] >= Constants.THROTTLE_QUEUE_SIZE then
return false -- no room in throttle queue
else
callback() -- would i.e. trigger a warning in output
table.insert(budgetRequestQueues[mainRequestType], 1, {
After = 0; -- no write lock
Thread = coroutine.running();
Budget = budget;
})
coroutine.yield()
end
return true
end
function MockDataStoreManager.ExportToJSON()
local export = {}
if next(Data.GlobalDataStore) ~= nil then -- GlobalDataStore not empty
export.GlobalDataStore = Data.GlobalDataStore
end
export.DataStore = Utils.prepareDataStoresForExport(Data.DataStore) -- can be nil
export.OrderedDataStore = Utils.prepareDataStoresForExport(Data.OrderedDataStore) -- can be nil
return HttpService:JSONEncode(export)
end
|
--print(Speed)
|
Velocidade = Speed
TS:Create(Main.Status.Barra.Stamina, TweenInfo.new(.25), {Size = UDim2.new(Speed/(ServerConfig.RunWalkSpeed * StancesPasta.Mobility.Value),0,0.75,0)} ):Play()
end)
TS:Create(script.Parent.Efeitos.Health, TweenInfo.new(1,Enum.EasingStyle.Circular,Enum.EasingDirection.InOut,-1,true), {Size = UDim2.new(1.2,0,1.4,0)} ):Play()
Humanoid.Changed:Connect(function(Health)
script.Parent.Efeitos.Health.ImageTransparency = ((Humanoid.Health - (Humanoid.MaxHealth/2))/(Humanoid.MaxHealth/2))
--[[if Humanoid.Health <= (Humanoid.MaxHealth/2) then
script.Parent.Efeitos.Health.BackgroundTransparency = ((Humanoid.Health)/(Humanoid.MaxHealth/2))
script.Parent.Efeitos.Health.BackgroundColor3 = Color3.fromRGB((170 * (Humanoid.Health)/(Humanoid.MaxHealth/2)) , 0, 0)
--script.Parent.Efeitos.Health.ImageColor3 = Color3.fromRGB((170 * (Humanoid.Health)/(Humanoid.MaxHealth/2)) , 0, 0)
else
--script.Parent.Efeitos.Health.ImageColor3 = Color3.fromRGB(170, 0, 0)
script.Parent.Efeitos.Health.BackgroundTransparency = 1
script.Parent.Efeitos.Health.BackgroundColor3 = Color3.fromRGB(170, 0, 0)
end]]
end)
Ferido.Changed:Connect(function(Valor)
|
--[[local gui = Instance.new("ScreenGui")
local bg = Instance.new("Frame",gui)
local bar = Instance.new("Frame",bg)
local bvl = Instance.new("ImageLabel", bg)
bvl.Name = "Bevel"
bvl.BackgroundTransparency = 1
bvl.Image = "http://www.roblox.com/asset/?id=56852431"
bvl.Size = UDim2.new(1,0,1,0)
bg.Name = "Back"
bar.Name = "Charge"
bar.BackgroundColor3 = Color3.new(200/255,0/255,0/255)
bg.BackgroundColor3 = Color3.new(200/255,200/255,200/255)
bg.Size = UDim2.new(0,10,0,-100)
bg.Position = UDim2.new(0,5,0,500)
bar.Size = UDim2.new(0,4,-1,0)
bar.Position = UDim2.new(0,3,1,0)
ggui = gui:Clone()
ggui.Name = "GunGui"
ggui.Back.Charge.Size = UDim2.new(0,4,-(script.Charge.Value/100),0)]]
|
GroupID = 9999
function AntiGH(char1,char2)
if GH then
local plyr1 = game.Players:findFirstChild(char1.Name)
local plyr2 = game.Players:findFirstChild(char2.Name)
if plyr1 and plyr2 then
if plyr1:IsInGroup(GroupID) and plyr2:IsInGroup(GroupID) then
return false
end
end
return true
elseif not GH then
return true
end
end
MaxDist = 1000
function RayCast(Start,End,Ignore)
if WallShoot then
ray1 = Ray.new(Start, End.unit * 999.999)
local Part1, TempPos = Workspace:FindPartOnRay(ray1,Ignore)
ray2 = Ray.new(TempPos, End.unit * 999.999)
local Part2, EndPos = Workspace:FindPartOnRay(ray2,Part1)
return Part1, Part2, EndPos
elseif not WallShoot then
ray = Ray.new(Start, End.unit * 999.999)
return Workspace:FindPartOnRay(ray,Ignore)
end
end
function DmgPlr(Part)
if Part ~= nil then
local c = Instance.new("ObjectValue")
c.Name = "creator"
c.Value = game.Players:findFirstChild(script.Parent.Parent.Name)
local hum = Part.Parent:findFirstChild("Humanoid")
local hathum = Part.Parent.Parent:findFirstChild("Humanoid")
local hat = Part.Parent
if hathum ~= nil and hat:IsA("Hat") and AntiGH(hathum.Parent, script.Parent.Parent) then
hathum:TakeDamage(Damage/1)
Part.Parent = game.Workspace
Part.CFrame = CFrame.new(Part.Position + Vector3.new(math.random(-5,5),math.random(-5,5),math.random(-5,5)))
hat:Remove()
c.Parent = hathum
game.Debris:AddItem(c,1.5)
elseif hum ~= nil and AntiGH(hum.Parent, script.Parent.Parent) then
if Part.Name == "Head" then
hum:TakeDamage(Damage*1.3)
end
hum:TakeDamage(Damage)
c.Parent = hum
game.Debris:AddItem(c,1.5)
end
end
end
function onButton1Down(mouse)
if script.Parent.Ammo.Value == 0 then
else
if GunType == 0 then
if (not enabled) then return end
enabled = false
LaserShoot(mouse)
if Flash then
script.Parent.Barrel.Light.Light.Visible = true
end
script.Parent.Ammo.Value = script.Parent.Ammo.Value - 1
wait(0.01)
if Flash then
script.Parent.Barrel.Light.Light.Visible = false
end
wait(1/SPS)
enabled = true
elseif GunType == 1 then
automatichold = true
while automatichold == true and script.Parent.Ammo.Value ~= 0 do wait()
if (not enabled) then return end
if script.Parent.Parent:findFirstChild("Humanoid").Health == 0 then script.Parent:Remove() end
enabled = false
LaserShoot(mouse)
if Flash then
script.Parent.Barrel.Light.Light.Visible = true
end
script.Parent.Ammo.Value = script.Parent.Ammo.Value - 1
wait(0.01)
if Flash then
script.Parent.Barrel.Light.Light.Visible = false
end
wait(1/SPS)
enabled = true
end
end
end
end
function LaserShoot(mouse)
hit = mouse.Hit.p
local StartPos = script.Parent.Barrel.CFrame.p
local rv = (StartPos-hit).magnitude/(Recoil * 20)
local rcl = Vector3.new(math.random(-rv,rv),math.random(-rv,rv),math.random(-rv,rv))
aim = hit + rcl
local P = Instance.new("Part")
P.Name = "Bullet"
P.formFactor = 3
P.BrickColor = BrickColor.new(BulletColor)
P.Size = Vector3.new(1,1,1)
P.Anchored = true
P.CanCollide = false
P.Transparency = 0.5
P.Parent = script.Parent.Parent
local m = Instance.new("CylinderMesh")
m.Name = "Mesh"
m.Parent = P
local c = Instance.new("ObjectValue")
c.Name = "creator"
c.Value = game.Players:findFirstChild(script.Parent.Parent.Name)
pewsound = script:FindFirstChild("Fire")
if pewsound then
pewsound:Play()
end --Brick created. Moving on to next part
local SPos = script.Parent.Barrel.CFrame.p
if WallShoot then
local Part1, Part2, EndPos = RayCast(SPos, (aim-SPos).unit * 999, script.Parent.Parent)
DmgPlr(Part1)
DmgPlr(Part2)
if Part1 and Part2 then
local enddist = (EndPos-SPos).magnitude
P.CFrame = CFrame.new(EndPos, SPos) * CFrame.new(0,0,-enddist/2) * CFrame.Angles(math.rad(90),0,0)
m.Scale = Vector3.new(.04,enddist,.04)
else
P.CFrame = CFrame.new(EndPos, SPos) * CFrame.new(0,0,-MaxDist/2) * CFrame.Angles(math.rad(90),0,0)
m.Scale = Vector3.new(.04,MaxDist,.04)
end
elseif not WallShoot then
local Part, Pos = RayCast(SPos, (aim-SPos).unit * 999, script.Parent.Parent)
DmgPlr(Part)
if Part then
local dist = (Pos-SPos).magnitude
P.CFrame = CFrame.new(Pos, SPos) * CFrame.new(0,0,-dist/2) * CFrame.Angles(math.rad(90),0,0)
m.Scale = Vector3.new(.1,dist,.1)
else
P.CFrame = CFrame.new(Pos, SPos) * CFrame.new(0,0,-MaxDist/2) * CFrame.Angles(math.rad(90),0,0)
m.Scale = Vector3.new(.1,MaxDist,.1)
end
end
game.Debris:AddItem(P,.1)
end
function onButton1Up(mouse)
automatichold = false
end
function onKeyDown(key, mouse)
if key:lower() == "r" then
if script.Parent.Ammo.Value ~= script.Parent.MaxAmmo.Value then
reloadsound = script:FindFirstChild("Reload")
if reloadsound then
reloadsound:Play()
end
enabled = false
script.Parent.VisibleB.Value = true
script.Parent.StringValue.Value = "Reloading"
repeat script.Parent.StringValue.Value = "Reloading" wait(0.23) script.Parent.Ammo.Value = script.Parent.Ammo.Value + 3 script.Parent.StringValue.Value = "Reloading" until script.Parent.Ammo.Value >= script.Parent.MaxAmmo.Value
script.Parent.Ammo.Value = script.Parent.MaxAmmo.Value
wait(0.2)
script.Parent.VisibleB.Value = false
enabled = true
end
end
if key:lower() == "m" then
if GunType == 1 then
GunType = 0
Recoil = 7
else
GunType = 1
Recoil = 6
end
end
end
function onEquipped(mouse)
equipped = true
if mouse == nil then
print("Mouse not found")
return
end
mouse.Icon = "http://www.roblox.com/asset/?id=52812029"
mouse.Button1Down:connect(function() onButton1Down(mouse) end)
mouse.Button1Up:connect(function() onButton1Up(mouse) end)
mouse.KeyDown:connect(function(key) onKeyDown(key, mouse) end)
end
function onUnequipped(mouse)
equipped = false
automatichold = false
end
script.Parent.Equipped:connect(onEquipped)
script.Parent.Unequipped:connect(onUnequipped)
while true do wait()
if script.Parent.Ammo.Value == 0 then
script.Parent.VisibleB.Value = true
script.Parent.StringValue.Value = "Reload"
end
if GunType == 1 then
script.Parent.ModeText.Value = "Auto"
else
script.Parent.ModeText.Value = "Semi"
end
end
|
--//seats
|
local hd = Instance.new("Motor", script.Parent.Parent.Misc.HD.SS)
hd.MaxVelocity = 0.03
hd.Part0 = script.Parent.HD
hd.Part1 = hd.Parent
local wl = Instance.new("Motor", script.Parent.Parent.Misc.FL.Window.SS) --windows
local wr = Instance.new("Motor", script.Parent.Parent.Misc.FR.Window.SS)
wl.MaxVelocity = 0.007
wl.Part0 = script.Parent.Parent.Misc.FL.Door.WD
wl.Part1 = wl.Parent
wr.MaxVelocity = 0.007
wr.Part0 = script.Parent.Parent.Misc.FR.Door.WD
wr.Part1 = wr.Parent
|
--[=[
Promises attribute value fits predicate
@param instance Instance
@param attributeName string
@param predicate function | nil
@param cancelToken CancelToken
@return Promise<any>
]=]
|
function AttributeUtils.promiseAttribute(instance, attributeName, predicate, cancelToken)
assert(typeof(instance) == "Instance", "Bad instance")
assert(type(attributeName) == "string", "Bad attributeName")
assert(CancelToken.isCancelToken(cancelToken) or cancelToken == nil, "Bad cancelToken")
predicate = predicate or DEFAULT_PREDICATE
do
local attributeValue = instance:GetAttribute(attributeName)
if predicate(attributeValue) then
return Promise.resolved(attributeValue)
end
end
local promise = Promise.new()
local maid = Maid.new()
maid:GiveTask(promise)
if cancelToken then
maid:GiveTask(cancelToken.Cancelled:Connect(function()
promise:Reject()
end))
end
maid:GiveTask(instance:GetAttributeChangedSignal(attributeName):Connect(function()
local attributeValue = instance:GetAttribute(attributeName)
if predicate(attributeValue) then
promise:Resolve(attributeValue)
end
end))
promise:Finally(function()
maid:DoCleaning()
end)
return promise
end
|
--Flip a seat
|
local function flipSeat() --Done server side incase physics control is not the players
Remotes.FlipSeat:FireServer(AdornedSeat)
end
|
--[=[
@within TableUtil
@function Values
@param tbl table
@return table
Returns an array with all the values in the table.
```lua
local t = {A = 10, B = 20, C = 30}
local values = TableUtil.Values(t)
print(values) --> {10, 20, 30}
```
:::caution Ordering
The ordering of the values is never guaranteed. If order is imperative, call
`table.sort` on the resulting `values` array.
```lua
local values = TableUtil.Values(t)
table.sort(values)
```
]=]
|
local function Values(tbl: Table): Table
local values = table.create(#tbl)
for _, v in pairs(tbl) do
table.insert(values, v)
end
return values
end
|
--Well, thats all there is to it! Go to my fourms for "Online" questions about scripts--
| |
-- ROBLOX upstream: https://github.com/facebook/jest/blob/v27.4.7/packages/jest-snapshot/src/index.ts
-- /**
-- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
-- *
-- * This source code is licensed under the MIT license found in the
-- * LICENSE file in the root directory of this source tree.
-- */
| |
-- Variables
|
local ts = game:GetService('TweenService')
local cas = game:GetService('ContextActionService')
local cam = workspace.CurrentCamera
local humanoid = script.Parent:WaitForChild("Humanoid",3)
local sprintAnim = humanoid:LoadAnimation(script:WaitForChild("SprintAnim"))
local isSprinting, ifSprintAnimPlaying = false, false
local FOVIn = ts:Create(
cam,
TweenInfo.new(.5),
{FieldOfView = 100}
)
local FOVOut = ts:Create(
cam,
TweenInfo.new(.5),
{FieldOfView = 70}
)
|
--// Handling Settings
|
Firerate = 60 / 1000; -- 60 = 1 Minute, 700 = Rounds per that 60 seconds. DO NOT TOUCH THE 60!
FireMode = 2; -- 1 = Semi, 2 = Auto, 3 = Burst, 4 = Bolt Action, 5 = Shot, 6 = Explosive
|
-- SolarCrane
|
local MAX_TWEEN_RATE = 2.8 -- per second
local function clamp(low, high, num)
if low <= high then
return math.min(high, math.max(low, num))
end
return num
end
local function Round(num, places)
places = places or 0
local decimalPivot = 10^places
return math.floor(num * decimalPivot + 0.5) / decimalPivot
end
local function CreateTransparencyController()
local module = {}
local LastUpdate = tick()
local TransparencyDirty = false
local Enabled = false
local LastTransparency = nil
local DescendantAddedConn, DescendantRemovingConn = nil, nil
local ToolDescendantAddedConns = {}
local ToolDescendantRemovingConns = {}
local CachedParts = {}
local function HasToolAncestor(object)
if object.Parent == nil then return false end
return object.Parent:IsA('Tool') or HasToolAncestor(object.Parent)
end
local function IsValidPartToModify(part)
if part:IsA('BasePart') or part:IsA('Decal') then
return not HasToolAncestor(part)
end
return false
end
local function CachePartsRecursive(object)
if object then
if IsValidPartToModify(object) then
CachedParts[object] = true
TransparencyDirty = true
end
for _, child in pairs(object:GetChildren()) do
CachePartsRecursive(child)
end
end
end
local function TeardownTransparency()
for child, _ in pairs(CachedParts) do
child.LocalTransparencyModifier = 0
end
CachedParts = {}
TransparencyDirty = true
LastTransparency = nil
if DescendantAddedConn then
DescendantAddedConn:disconnect()
DescendantAddedConn = nil
end
if DescendantRemovingConn then
DescendantRemovingConn:disconnect()
DescendantRemovingConn = nil
end
for object, conn in pairs(ToolDescendantAddedConns) do
conn:disconnect()
ToolDescendantAddedConns[object] = nil
end
for object, conn in pairs(ToolDescendantRemovingConns) do
conn:disconnect()
ToolDescendantRemovingConns[object] = nil
end
end
local function SetupTransparency(character)
TeardownTransparency()
if DescendantAddedConn then DescendantAddedConn:disconnect() end
DescendantAddedConn = character.DescendantAdded:connect(function(object)
-- This is a part we want to invisify
if IsValidPartToModify(object) then
CachedParts[object] = true
TransparencyDirty = true
-- There is now a tool under the character
elseif object:IsA('Tool') then
if ToolDescendantAddedConns[object] then ToolDescendantAddedConns[object]:disconnect() end
ToolDescendantAddedConns[object] = object.DescendantAdded:connect(function(toolChild)
CachedParts[toolChild] = nil
if toolChild:IsA('BasePart') or toolChild:IsA('Decal') then
-- Reset the transparency
toolChild.LocalTransparencyModifier = 0
end
end)
if ToolDescendantRemovingConns[object] then ToolDescendantRemovingConns[object]:disconnect() end
ToolDescendantRemovingConns[object] = object.DescendantRemoving:connect(function(formerToolChild)
wait() -- wait for new parent
if character and formerToolChild and formerToolChild:IsDescendantOf(character) then
if IsValidPartToModify(formerToolChild) then
CachedParts[formerToolChild] = true
TransparencyDirty = true
end
end
end)
end
end)
if DescendantRemovingConn then DescendantRemovingConn:disconnect() end
DescendantRemovingConn = character.DescendantRemoving:connect(function(object)
if CachedParts[object] then
CachedParts[object] = nil
-- Reset the transparency
object.LocalTransparencyModifier = 0
end
end)
CachePartsRecursive(character)
end
function module:SetEnabled(newState)
if Enabled ~= newState then
Enabled = newState
self:Update()
end
end
function module:SetSubject(subject)
local character = nil
if subject and subject:IsA("Humanoid") then
character = subject.Parent
end
if subject and subject:IsA("VehicleSeat") and subject.Occupant then
character = subject.Occupant.Parent
end
if character then
SetupTransparency(character)
else
TeardownTransparency()
end
end
function module:Update()
local instant = false
local now = tick()
local currentCamera = workspace.CurrentCamera
if currentCamera then
local transparency = 0
if not Enabled then
instant = true
else
local distance = (currentCamera.Focus.p - currentCamera.CoordinateFrame.p).magnitude
transparency = (7 - distance) / 5
if transparency < 0.5 then
transparency = 0
end
if LastTransparency then
local deltaTransparency = transparency - LastTransparency
-- Don't tween transparency if it is instant or your character was fully invisible last frame
if not instant and transparency < 1 and LastTransparency < 0.95 then
local maxDelta = MAX_TWEEN_RATE * (now - LastUpdate)
deltaTransparency = clamp(-maxDelta, maxDelta, deltaTransparency)
end
transparency = LastTransparency + deltaTransparency
else
TransparencyDirty = true
end
transparency = clamp(0, 1, Round(transparency, 2))
end
if TransparencyDirty or LastTransparency ~= transparency then
for child, _ in pairs(CachedParts) do
child.LocalTransparencyModifier = transparency
end
TransparencyDirty = false
LastTransparency = transparency
end
end
LastUpdate = now
end
return module
end
return CreateTransparencyController
|
-- print("Wha " .. pose)
|
amplitude = 0.1
frequency = 1
setAngles = true
end
if (setAngles) then
local desiredAngle = amplitude * math.sin(time * frequency)
RightShoulder:SetDesiredAngle(desiredAngle + climbFudge)
LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge)
RightHip:SetDesiredAngle(-desiredAngle)
LeftHip:SetDesiredAngle(-desiredAngle)
end
-- Tool Animation handling
local tool = getTool()
if tool then
local animStringValueObject = getToolAnim(tool)
if animStringValueObject then
toolAnim = animStringValueObject.Value
-- message recieved, delete StringValue
animStringValueObject.Parent = nil
toolAnimTime = time + .3
end
if time > toolAnimTime then
toolAnimTime = 0
toolAnim = "None"
end
animateTool()
else
stopToolAnimations()
toolAnim = "None"
toolAnimTime = 0
end
end
|
--Make a collision group for all players' characters
|
PhysicsService:CreateCollisionGroup(GroupName)
|
-- Animation
|
CEs.AnimateT.OnClientEvent:connect(function(Part,NCF,Time,O)
if Part:IsDescendantOf(plr.Character) then return end
if O then
TweenService:Create(Part,TweenInfo.new(Time),O):Play()
else
TweenService:Create(Part,TweenInfo.new(Time),{C1=NCF}):Play()
end
end)
CEs.AnimateFE.OnClientEvent:connect(function(w,Time,Ans,NAngle,NRotation,Rchr,HigV)
if Rchr == plr.Character then return end
TweenService:Create(Rchr.Torso.Neck,TweenInfo.new(Time),{C0=OriginalC0*CFrame.Angles(Ans,NAngle,NRotation)}):Play()
TweenService:Create(Rchr.Torso.Mweld1,TweenInfo.new(Time),
{C1=w[1]*CFrame.new(0,HigV,0)}):Play()
TweenService:Create(Rchr.Torso.Mweld2,TweenInfo.new(Time),
{C1=w[2]*CFrame.new(0,HigV,0)}):Play()
if w[3] then -- Check if there is an extra weld
TweenService:Create(Rchr["Right Arm"].Mweld3,TweenInfo.new(Time),
{C1=w[3]*CFrame.new(0,HigV,0)}):Play()
end
TweenService:Create(Rchr.HumanoidRootPart.Mtweld,TweenInfo.new(Time),
{C1=w[4]*CFrame.new(0,HigV,0)}):Play()
end)
function checktoolsupdatemouse()
local char = game.Players.LocalPlayer.Character
for i,v in pairs(char:GetChildren()) do
if v:IsA("Tool") then
gui.FakeC.Visible = true
game:GetService("UserInputService").MouseIconEnabled = false
return
end
end
gui.FakeC.Visible = false
game:GetService("UserInputService").MouseIconEnabled = true
end
game.Players.LocalPlayer.Character.ChildAdded:Connect(checktoolsupdatemouse)
game.Players.LocalPlayer.Character.ChildRemoved:Connect(checktoolsupdatemouse)
checktoolsupdatemouse()
|
--Returns the name of the weapon for the kill feeds.
|
local function GetDamageName()
if GetReflectedByPlayer() then
return "Reflector"
end
return "Rocket Launcher"
end
|
----- water handler -----
|
while true do
if script.Parent.HotOn.Value == true and script.Parent.ColdOn.Value == true and script.Parent.Plugged.Value == true and water.Scale.Y <= 2 then -- if BOTH ON and PLUGGED
water.Scale = water.Scale + Vector3.new(0,0.01,0)
water.Offset = Vector3.new(0,water.Scale.Y/2,0)
hotWater = hotWater + 1
coldWater = coldWater + 1
drainSound:Stop()
elseif (script.Parent.HotOn.Value == true or script.Parent.ColdOn.Value == true) and script.Parent.Plugged.Value == true and water.Scale.Y <= 2 then -- if ON and PLUGGED
water.Scale = water.Scale + Vector3.new(0,0.01,0)
water.Offset = Vector3.new(0,water.Scale.Y/2,0)
if script.Parent.HotOn.Value == true then
hotWater = hotWater + 1
else
coldWater = coldWater + 1
end
drainSound:Stop()
elseif (script.Parent.HotOn.Value == true or script.Parent.ColdOn.Value == true) and script.Parent.Plugged.Value == false and water.Scale.Y <= 2 then -- if ON and NOT PLUGGED
if script.Parent.HotOn.Value == true then
coldWater = coldWater - 1
else
hotWater = hotWater - 1
end
drainSound:Stop()
elseif (script.Parent.HotOn.Value == false and script.Parent.ColdOn.Value == false) and script.Parent.Plugged.Value == false and water.Scale.Y > 0 then -- if NOT ON and NOT PLUGGED
water.Scale = water.Scale + Vector3.new(0,-0.01,0)
water.Offset = Vector3.new(0,water.Scale.Y/2,0)
coldWater = coldWater - 1
hotWater = hotWater - 1
drainSound:Play()
end
if coldWater < 1 then
coldWater = 1
end
if hotWater < 1 then
hotWater = 1
end
waterTemp = hotWater/coldWater
if waterTemp > 1 then
water.Parent.SteamEmitter.Enabled = true
else
water.Parent.SteamEmitter.Enabled = false
end
wait(0.1)
if script.Parent.ColdOn.Value == true or script.Parent.HotOn.Value == true then
script.Parent.Splash.ParticleEmitter.Enabled = true
else
script.Parent.Splash.ParticleEmitter.Enabled = false
end
if water.Scale.Y <= 0 then
drainSound:Stop()
end
end
|
--======================================--
--===============Weld Part1(WP1)===============--
--======================================--
|
w1.Part1 = bin.Armslot
w2.Part1 = bin.Sphere
w3.Part1 = bin.ThumbJoint
w4.Part1 = bin.ThumbTip
w5.Part1 = bin.IndexJoint
w6.Part1 = bin.IndexTip
w7.Part1 = bin.CenterJoint
w8.Part1 = bin.CenterTip
w9.Part1 = bin.RingJoint
w10.Part1 = bin.RingTip
w11.Part1 = bin.PinkieJoint
w12.Part1 = bin.PinkieTip
|
--
|
script.Parent.Handle3.Hinge1.Transparency = 1
script.Parent.Handle3.Interactive1.Transparency = 1
script.Parent.Handle3.Part1.Transparency = 1
wait(0.06)
script.Parent.Handle1.Hinge1.Transparency = 0
script.Parent.Handle1.Interactive1.Transparency = 0
script.Parent.Handle1.Part1.Transparency = 0
|
-- ROBLOX NOTE: no upstream
|
local CurrentModule = script
local Packages = CurrentModule.Parent
local JestMock = require(Packages.JestMock).ModuleMocker
local JestFakeTimers = require(Packages.JestFakeTimers)
local fakeTimers = JestFakeTimers.new()
local mock = JestMock.new()
|
--Stop animation if...--
|
Humanoid.Changed:connect(function()
if Humanoid.Jump and RAnimation.IsPlaying then
RAnimation:Stop()
end
end)
|
--[=[
Gets the 3D world position of the mouse when projected forward. This would be the
end-position of a raycast if nothing was hit. Similar to `Raycast`, optional
`distance` and `overridePos` arguments are allowed.
Use `Project` if you want to get the 3D world position of the mouse at a given
distance but don't care about any objects that could be in the way. It is much
faster to project a position into 3D space than to do a full raycast operation.
```lua
local params = RaycastParams.new()
local distance = 200
local result = mouse:Raycast(params, distance)
if result then
-- Do something with result
else
-- Raycast failed, but still get the world position of the mouse:
local worldPosition = mouse:Project(distance)
end
```
]=]
|
function Mouse:Project(distance: number?, overridePos: Vector2?): Vector3
local viewportMouseRay = self:GetRay(overridePos)
return viewportMouseRay.Origin + (viewportMouseRay.Direction.Unit * (distance or RAY_DISTANCE))
end
|
-- local SNAPSHOT_VERSION_REGEXP = "^// Jest Snapshot v(.+),"
|
local SNAPSHOT_GUIDE_LINK = "http://roblox.github.io/jest-roblox/snapshot-testing"
|
--returns the wielding player of this tool
|
function getPlayer()
local char = Tool.Parent
return game:GetService("Players"):GetPlayerFromCharacter(Character)
end
function Toss(direction)
local handlePos = Vector3.new(Tool.Handle.Position.X, 0, Tool.Handle.Position.Z)
local spawnPos = Character.Head.Position
spawnPos = spawnPos + (direction * 5)
Tool.Handle.Part.Transparency = 1
Tool.Handle.Part.Neon.Transparency = 1
local Object = Tool.Handle:Clone()
Object.Parent = workspace
Object.Part.Transparency = 0
Object.Part.Neon.Transparency = 0
Object.Fuse:Play()
Object.Swing.Pitch = Random.new():NextInteger(90, 110)/100
Object.Swing:Play()
Object.CanCollide = true
Object.CFrame = Tool.Handle.CFrame
Object.Velocity = (direction*AttackVelocity) + Vector3.new(0,AttackVelocity/7.5,0)
Object.Trail.Enabled = true
local rand = 11.25
Object.RotVelocity = Vector3.new(Random.new():NextNumber(-rand,rand),Random.new():NextNumber(-rand,rand),Random.new():NextNumber(-rand,rand))
Object:SetNetworkOwner(getPlayer())
local ScriptClone = DamageScript:Clone()
ScriptClone.Parent = Object
ScriptClone.Disabled = false
local tag = Instance.new("ObjectValue")
tag.Value = getPlayer()
tag.Name = "creator"
tag.Parent = Object
end
PowerRemote.OnServerEvent:Connect(function(player, Power)
local holder = getPlayer()
if holder ~= player then return end
AttackVelocity = Power
end)
TossRemote.OnServerEvent:Connect(function(player, mousePosition)
local holder = getPlayer()
if holder ~= player then return end
if Cooldown.Value == true then return end
Cooldown.Value = true
local holder = getPlayer()
if Humanoid and Humanoid.RigType == Enum.HumanoidRigType.R15 then
TossRemote:FireClient(getPlayer(), "PlayAnimation", "Animation")
end
local targetPos = mousePosition.p
local lookAt = (targetPos - Character.Head.Position).unit
Toss(lookAt)
Tool:Destroy()
end)
Tool.Equipped:Connect(function()
Character = Tool.Parent
Humanoid = Character:FindFirstChildOfClass("Humanoid")
end)
Tool.Unequipped:Connect(function()
Character = nil
Humanoid = nil
end)
|
------------------------------------------------------------------------
|
local PlayerState = {} do
local mouseBehavior
local mouseIconEnabled
local cameraType
local cameraFocus
local cameraCFrame
local cameraFieldOfView
local screenGuis = {}
local coreGuis = {
Backpack = true,
Chat = true,
Health = true,
PlayerList = true,
}
local setCores = {
BadgesNotificationsActive = true,
PointsNotificationsActive = true,
}
-- Save state and set up for freecam
function PlayerState.Push()
for name in pairs(coreGuis) do
coreGuis[name] = StarterGui:GetCoreGuiEnabled(Enum.CoreGuiType[name])
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType[name], false)
end
for name in pairs(setCores) do
setCores[name] = StarterGui:GetCore(name)
StarterGui:SetCore(name, false)
end
local playergui = LocalPlayer:FindFirstChildOfClass("PlayerGui")
if playergui then
for _, gui in pairs(playergui:GetChildren()) do
if gui:IsA("ScreenGui") and gui.Enabled then
screenGuis[#screenGuis + 1] = gui
gui.Enabled = false
end
end
end
cameraFieldOfView = Camera.FieldOfView
Camera.FieldOfView = 70
cameraType = Camera.CameraType
Camera.CameraType = Enum.CameraType.Custom
cameraCFrame = Camera.CFrame
cameraFocus = Camera.Focus
mouseIconEnabled = UserInputService.MouseIconEnabled
UserInputService.MouseIconEnabled = false
mouseBehavior = UserInputService.MouseBehavior
UserInputService.MouseBehavior = Enum.MouseBehavior.Default
end
-- Restore state
function PlayerState.Pop()
for name, isEnabled in pairs(coreGuis) do
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType[name], isEnabled)
end
for name, isEnabled in pairs(setCores) do
StarterGui:SetCore(name, isEnabled)
end
for _, gui in pairs(screenGuis) do
if gui.Parent then
gui.Enabled = true
end
end
Camera.FieldOfView = cameraFieldOfView
cameraFieldOfView = nil
Camera.CameraType = cameraType
cameraType = nil
Camera.CFrame = cameraCFrame
cameraCFrame = nil
Camera.Focus = cameraFocus
cameraFocus = nil
UserInputService.MouseIconEnabled = mouseIconEnabled
mouseIconEnabled = nil
UserInputService.MouseBehavior = mouseBehavior
mouseBehavior = nil
end
end
local function StartFreecam()
local cameraCFrame = Camera.CFrame
cameraRot = Vector2.new(cameraCFrame:toEulerAnglesYXZ())
cameraPos = cameraCFrame.p
cameraFov = Camera.FieldOfView
velSpring:Reset(Vector3.new())
panSpring:Reset(Vector2.new())
fovSpring:Reset(0)
PlayerState.Push()
RunService:BindToRenderStep("Freecam", Enum.RenderPriority.Camera.Value, StepFreecam)
Input.StartCapture()
end
local function StopFreecam()
Input.StopCapture()
RunService:UnbindFromRenderStep("Freecam")
PlayerState.Pop()
end
|
--If you want to test it this in Roblox Studio, Change the LocalScript to Script
| |
--Prompt[] Prompts
--* the prompts which this response could possibly evaluate to.
--* the prompts are ordered by their priority and examined.
--* the first valid prompt is used.
|
Response.Prompts = {}
function Response:InitPrompts()
self.Prompts = {}
end
function Response:GetPrompts()
return self.Prompts
end
function Response:AddPrompt(prompt)
if not prompt:IsA(self:GetClass"Prompt") then
error("Attempted to add a non-Prompt to a Response.")
end
table.insert(self.Prompts, prompt)
end
function Response:RemovePrompt(promptIn)
for index, prompt in pairs(self.Prompts) do
if prompt == promptIn then
table.remove(self.Prompts, index)
break
end
end
end
function Response:ClearPrompts()
self.Prompts = {}
end
|
--CONFIG:
|
local dayStart = 6 --The hour day starts
local dayEnd = 18 --The hours day ends
local daytimeInSeconds = 60*5 --How many seconds should daytime last?
local nightInSeconds = 60*2 --How many seconds should night last?
updateTick = 5 --How often should lighting update?
|
-- ROBLOX deviation: moved to RobloxShared to avoid reaching into internals with rotriever workspaces
-- local isAsymmetric = RobloxShared.expect.isAsymmetric
-- local asymmetricMatch = RobloxShared.expect.asymmetricMatch
-- local eq = RobloxShared.expect.eq
-- local keys = RobloxShared.expect.keys
| |
-- Call the fetch_items function
|
local items = fetch_items()
local db= false
local ContentProvider = game:GetService("ContentProvider")
ContentProvider:PreloadAsync(script.Parent.List.Grid:GetChildren())
print("done!")
|
--Automatic Gauge Scaling
|
if autoscaling then
local Drive={}
if _Tune.Config == "FWD" or _Tune.Config == "AWD" then
if car.Wheels:FindFirstChild("FL")~= nil then
table.insert(Drive,car.Wheels.FL)
end
if car.Wheels:FindFirstChild("FR")~= nil then
table.insert(Drive,car.Wheels.FR)
end
if car.Wheels:FindFirstChild("F")~= nil then
table.insert(Drive,car.Wheels.F)
end
end
if _Tune.Config == "RWD" or _Tune.Config == "AWD" then
if car.Wheels:FindFirstChild("RL")~= nil then
table.insert(Drive,car.Wheels.RL)
end
if car.Wheels:FindFirstChild("RR")~= nil then
table.insert(Drive,car.Wheels.RR)
end
if car.Wheels:FindFirstChild("R")~= nil then
table.insert(Drive,car.Wheels.R)
end
end
local wDia = 0
for i,v in pairs(Drive) do
if v.Size.x>wDia then wDia = v.Size.x end
end
Drive = nil
for i,v in pairs(UNITS) do
v.maxSpeed = math.ceil(v.scaling*wDia*math.pi*_lRPM/60/_Tune.Ratios[#_Tune.Ratios]/_Tune.FinalDrive/_Tune.FDMult)
v.spInc = math.max(math.ceil(v.maxSpeed/150)*10,10)
end
end
for i=0,revEnd*2 do
local ln = gauges.ln:clone()
ln.Parent = gauges.Tach
ln.Rotation = 45 + i * 225 / (revEnd*2)
ln.Num.Text = i/2
ln.Num.Rotation = -ln.Rotation
if i*500>=math.floor(_pRPM/500)*500 then
ln.Frame.BackgroundColor3 = Color3.new(1,0,0)
if i<revEnd*2 then
ln2 = ln:clone()
ln2.Parent = gauges.Tach
ln2.Rotation = 45 + (i+.5) * 225 / (revEnd*2)
ln2.Num:Destroy()
ln2.Visible=true
end
end
if i%2==0 then
ln.Frame.Size = UDim2.new(0,3,0,10)
ln.Frame.Position = UDim2.new(0,-1,0,100)
ln.Num.Visible = true
else
ln.Num:Destroy()
end
ln.Visible=true
end
local lns = Instance.new("Frame",gauges.Speedo)
lns.Name = "lns"
lns.BackgroundTransparency = 1
lns.BorderSizePixel = 0
lns.Size = UDim2.new(0,0,0,0)
for i=1,90 do
local ln = gauges.ln:clone()
ln.Parent = lns
ln.Rotation = 45 + 225*(i/90)
if i%2==0 then
ln.Frame.Size = UDim2.new(0,2,0,10)
ln.Frame.Position = UDim2.new(0,-1,0,100)
else
ln.Frame.Size = UDim2.new(0,3,0,5)
end
ln.Num:Destroy()
ln.Visible=true
end
local blns = Instance.new("Frame",gauges.Boost)
blns.Name = "blns"
blns.BackgroundTransparency = 1
blns.BorderSizePixel = 0
blns.Size = UDim2.new(0,0,0,0)
for i=0,12 do
local bln = gauges.bln:clone()
bln.Parent = blns
bln.Rotation = 45+270*(i/12)
if i%2==0 then
bln.Frame.Size = UDim2.new(0,2,0,7)
bln.Frame.Position = UDim2.new(0,-1,0,40)
else
bln.Frame.Size = UDim2.new(0,3,0,5)
end
bln.Num:Destroy()
bln.Visible=true
end
for i,v in pairs(UNITS) do
local lnn = Instance.new("Frame",gauges.Speedo)
lnn.BackgroundTransparency = 1
lnn.BorderSizePixel = 0
lnn.Size = UDim2.new(0,0,0,0)
lnn.Name = v.units
if i~= 1 then lnn.Visible=false end
for i=0,v.maxSpeed,v.spInc do
local ln = gauges.ln:clone()
ln.Parent = lnn
ln.Rotation = 45 + 225*(i/v.maxSpeed)
ln.Num.Text = i
ln.Num.TextSize = 14
ln.Num.Rotation = -ln.Rotation
ln.Frame:Destroy()
ln.Num.Visible=true
ln.Visible=true
end
end
if isOn.Value then
gauges:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
isOn.Changed:connect(function()
if isOn.Value then
gauges:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
end)
values.RPM.Changed:connect(function()
gauges.Tach.Needle.Rotation = 45 + 225 * math.min(1,values.RPM.Value / (revEnd*1000))
end)
local _TCount = 0
if _Tune.Aspiration ~= "Natural" then
if _Tune.Aspiration == "Single" then
_TCount = 1
elseif _Tune.Aspiration == "Double" then
_TCount = 2
end
values.Boost.Changed:connect(function()
local boost = (math.floor(values.Boost.Value)*1.2)-((_Tune.Boost*_TCount)/5)
gauges.Boost.Needle.Rotation = 45 + 270 * math.min(1,(values.Boost.Value/(_Tune.Boost)/_TCount))
gauges.PSI.Text = tostring(math.floor(boost).." PSI")
end)
else
gauges.Boost:Destroy()
end
values.Gear.Changed:connect(function()
local gearText = values.Gear.Value
if gearText == 0 then gearText = "N"
elseif gearText == -1 then gearText = "R"
end
gauges.Gear.Text = gearText
end)
values.TCS.Changed:connect(function()
if _Tune.TCSEnabled then
if values.TCS.Value then
gauges.TCS.TextColor3 = Color3.new(1,170/255,0)
gauges.TCS.TextStrokeColor3 = Color3.new(1,170/255,0)
if values.TCSActive.Value then
wait()
gauges.TCS.Visible = not gauges.TCS.Visible
else
wait()
gauges.TCS.Visible = false
end
else
gauges.TCS.Visible = true
gauges.TCS.TextColor3 = Color3.new(1,0,0)
gauges.TCS.TextStrokeColor3 = Color3.new(1,0,0)
end
else
gauges.TCS.Visible = false
end
end)
values.TCSActive.Changed:connect(function()
if _Tune.TCSEnabled then
if values.TCSActive.Value and values.TCS.Value then
wait()
gauges.TCS.Visible = not gauges.TCS.Visible
elseif not values.TCS.Value then
wait()
gauges.TCS.Visible = true
else
wait()
gauges.TCS.Visible = false
end
else
gauges.TCS.Visible = false
end
end)
gauges.TCS.Changed:connect(function()
if _Tune.TCSEnabled then
if values.TCSActive.Value and values.TCS.Value then
wait()
gauges.TCS.Visible = not gauges.TCS.Visible
elseif not values.TCS.Value then
wait()
gauges.TCS.Visible = true
end
else
if gauges.TCS.Visible then
gauges.TCS.Visible = false
end
end
end)
values.ABS.Changed:connect(function()
if _Tune.ABSEnabled then
if values.ABS.Value then
gauges.ABS.TextColor3 = Color3.new(1,170/255,0)
gauges.ABS.TextStrokeColor3 = Color3.new(1,170/255,0)
if values.ABSActive.Value then
wait()
gauges.ABS.Visible = not gauges.ABS.Visible
else
wait()
gauges.ABS.Visible = false
end
else
gauges.ABS.Visible = true
gauges.ABS.TextColor3 = Color3.new(1,0,0)
gauges.ABS.TextStrokeColor3 = Color3.new(1,0,0)
end
else
gauges.ABS.Visible = false
end
end)
values.ABSActive.Changed:connect(function()
if _Tune.ABSEnabled then
if values.ABSActive.Value and values.ABS.Value then
wait()
gauges.ABS.Visible = not gauges.ABS.Visible
elseif not values.ABS.Value then
wait()
gauges.ABS.Visible = true
else
wait()
gauges.ABS.Visible = false
end
else
gauges.ABS.Visible = false
end
end)
gauges.ABS.Changed:connect(function()
if _Tune.ABSEnabled then
if values.ABSActive.Value and values.ABS.Value then
wait()
gauges.ABS.Visible = not gauges.ABS.Visible
elseif not values.ABS.Value then
wait()
gauges.ABS.Visible = true
end
else
if gauges.ABS.Visible then
gauges.ABS.Visible = false
end
end
end)
function PBrake()
gauges.PBrake.Visible = values.PBrake.Value
end
values.PBrake.Changed:connect(PBrake)
values.Velocity.Changed:connect(function(property)
gauges.Speedo.Needle.Rotation = 45 + 225 * math.min(1,UNITS[currentUnits].scaling*values.Velocity.Value.Magnitude/UNITS[currentUnits].maxSpeed)
gauges.Speed.Text = math.floor(UNITS[currentUnits].scaling*values.Velocity.Value.Magnitude) .. " "..UNITS[currentUnits].units
end)
mouse.KeyDown:connect(function(key)
if key=="v" then
gauges.Visible=not gauges.Visible
end
end)
gauges.Speed.MouseButton1Click:connect(function()
if currentUnits==#UNITS then
currentUnits = 1
else
currentUnits = currentUnits+1
end
for i,v in pairs(gauges.Speedo:GetChildren()) do
v.Visible=v.Name==UNITS[currentUnits].units or v.Name=="Needle" or v.Name=="lns"
end
gauges.Speed.Text = math.floor(UNITS[currentUnits].scaling*values.Velocity.Value.Magnitude) .. " "..UNITS[currentUnits].units
end)
wait(.1)
PBrake()
|
---[[ Chat Behaviour Settings ]]
|
module.WindowDraggable = true
module.WindowResizable = true
module.ShowChannelsBar = true
module.GamepadNavigationEnabled = false
module.AllowMeCommand = true -- Me Command will only be effective when this set to true
module.ShowUserOwnFilteredMessage = true --Show a user the filtered version of their message rather than the original.
|
-- << VARIABLES >>
|
local unBan = main.warnings.UnBan
local permRank = main.warnings.PermRank
local menuTemplates = main.gui.MenuTemplates
local pmId = 1
|
--Made by Luckymaxer
|
Debris = game:GetService("Debris")
Camera = game:GetService("Workspace").CurrentCamera
Sounds = {
RayHit = script:WaitForChild("Hit")
}
BasePart = Instance.new("Part")
BasePart.Shape = Enum.PartType.Block
BasePart.Material = Enum.Material.Plastic
BasePart.TopSurface = Enum.SurfaceType.Smooth
BasePart.BottomSurface = Enum.SurfaceType.Smooth
BasePart.FormFactor = Enum.FormFactor.Custom
BasePart.Size = Vector3.new(0.2, 0.2, 0.2)
BasePart.CanCollide = true
BasePart.Locked = true
BasePart.Anchored = false
BaseRay = BasePart:Clone()
BaseRay.Name = "Laser"
BaseRay.BrickColor = BrickColor.new("New Yeller")
BaseRay.Material = Enum.Material.SmoothPlastic
BaseRay.Size = Vector3.new(0.2, 0.2, 0.2)
BaseRay.Anchored = true
BaseRay.CanCollide = false
BaseRayMesh = Instance.new("SpecialMesh")
BaseRayMesh.Name = "Mesh"
BaseRayMesh.MeshType = Enum.MeshType.Brick
BaseRayMesh.Scale = Vector3.new(0.2, 0.2, 1)
BaseRayMesh.Offset = Vector3.new(0, 0, 0)
BaseRayMesh.VertexColor = Vector3.new(1, 1, 1)
BaseRayMesh.Parent = BaseRay
function PlaySound(Position, Sound)
local SoundPart = BasePart:Clone()
SoundPart.Name = "ParticlePart"
SoundPart.Transparency = 1
SoundPart.Anchored = true
SoundPart.CanCollide = false
local SoundObject = Sound:Clone()
SoundObject.Parent = SoundPart
Debris:AddItem(SoundPart, 1.5)
SoundPart.Parent = game:GetService("Workspace")
SoundPart.CFrame = CFrame.new(Position)
SoundObject:Play()
end
function FireRay(StartPosition, TargetPosition, Hit)
local Vec = (TargetPosition - StartPosition)
local Distance = Vec.magnitude
local Direction = Vec.unit
local PX = (StartPosition + (1 * Distance) * Direction)
local PY = (StartPosition + (1 * Distance) * Direction)
local PZ = (StartPosition + (1 * Distance) * Direction)
local DX = (StartPosition - PX).magnitude
local DY = (PX - PY).magnitude
local DZ = (PY - PZ).magnitude
local Limit = 2
local AX = (PX + Vector3.new(math.random(math.max(-Limit, (-0.21 * DX)), math.min(Limit, (0.21 * DX))),math.random(math.max(-Limit, (-0.21 * DX)),math.min(Limit, (0.21 * DX))), math.random(math.max(-Limit, (-0.21 * DX)), math.min(Limit, (0.21 * DX)))))
local AY = (PY + Vector3.new(math.random(math.max(-Limit, (-0.21 * DY)), math.min(Limit, (0.21 * DY))),math.random(math.max(-Limit, (-0.21 * DY)),math.min(Limit, (0.21 * DY))), math.random(math.max(-Limit, (-0.21 * DY)), math.min(Limit, (0.21 * DY)))))
local AZ = (PZ + Vector3.new(math.random(math.max(-Limit, (-0.21 * DZ)), math.min(Limit, (0.21 * DZ))),math.random(math.max(-Limit, (-0.21 * DZ)),math.min(Limit, (0.21 * DZ))), math.random(math.max(-Limit, (-0.21 * DZ)), math.min(Limit, (0.21 * DZ)))))
local Rays = {
{Distance = (AX - StartPosition).magnitude, Direction = CFrame.new(StartPosition, AX)},
{Distance = (AY - AX).magnitude, Direction = CFrame.new(AX, AY)},
{Distance = (AZ - AY).magnitude, Direction = CFrame.new(AY, AZ)},
{Distance = (TargetPosition - AZ).magnitude, Direction = CFrame.new(AZ, TargetPosition)},
}
for i, v in pairs(Rays) do
local Ray = BaseRay:Clone()
Ray.BrickColor = BrickColor.new("New Yeller")
Ray.Reflectance = 0.4
Ray.Transparency = 0.7
local Mesh = Ray.Mesh
Mesh.Scale = (Vector3.new(0.15, 0.15, (v.Distance / 1)) * 5)
Ray.CFrame = (v.Direction * CFrame.new(0, 0, (-0.5 * v.Distance)))
Debris:AddItem(Ray, (0.1 / (#Rays - (i - 1))))
Ray.Parent = Camera
end
end
pcall(function()
local StartPosition = script:WaitForChild("StartPosition").Value
local TargetPosition = script:WaitForChild("TargetPosition").Value
local RayHit = script:WaitForChild("RayHit").Value
FireRay(StartPosition, TargetPosition)
if RayHit then
PlaySound(TargetPosition, Sounds.RayHit)
end
end)
Debris:AddItem(script, 1)
|
-- you can mess with these settings
|
CanToggleMouse = {allowed = true; activationkey = Enum.KeyCode.Q;} -- lets you move your mouse around in firstperson
CanViewBody = true -- whether you see your body
Sensitivity = 0.6 -- anything higher would make looking up and down harder; recommend anything between 0~1
Smoothness = 0.15 -- recommend anything between 0~1
FieldOfView = 80 -- fov
HeadOffset = CFrame.new(0,0.7,0) -- how far your camera is from your head
local cam = game.Workspace.CurrentCamera
local player = players.LocalPlayer
local m = player:GetMouse()
m.Icon = "http://www.roblox.com/asset/?id=569021388" -- replaces mouse icon
local character = player.Character or player.CharacterAdded:wait()
local human = character.Humanoid
local humanoidpart = character.HumanoidRootPart
local head = character:WaitForChild("Head")
local CamPos,TargetCamPos = cam.CoordinateFrame.p,cam.CoordinateFrame.p
local AngleX,TargetAngleX = 0,0
local AngleY,TargetAngleY = 0,0
local running = true
local freemouse = false
local defFOV = FieldOfView
local w, a, s, d, lshift = false, false, false, false, false
|
-- [ FUNCTIONS ] --
|
Notification.OnClientEvent:Connect(function(Title, Description, Image)
if Image then
StarterGui:SetCore("SendNotification", {
Title = Title;
Text = Description;
Icon = Image;
})
else
StarterGui:SetCore("SendNotification", {
Title = Title;
Text = Description;
})
end
end)
|
--// DON'T EDIT BELOW
|
local target = plr.Character.HumanoidRootPart
local vel,pvel = script.Parent.Vel , script.Parent.PVel
local sensitivity = Vector3.new(sens,sens,sens)
local slurAngle = 0
local previousDesiredAngle = 0
local spinSpeed = 1 --ratio per second
local rotationOffset = -90 --in degrees
rotationOffset = math.rad(rotationOffset)
function Rotate()
local vec = target.CFrame.lookVector
local desiredAngle = math.atan2(vec.z, vec.x)
if desiredAngle < -1.57 and previousDesiredAngle > 1.57 then
slurAngle = slurAngle - math.pi*2
elseif desiredAngle > 1.57 and previousDesiredAngle < -1.57 then
slurAngle = slurAngle + math.pi*2
end
slurAngle = slurAngle*(1-spinSpeed) + desiredAngle*spinSpeed
local a = slurAngle + rotationOffset
previousDesiredAngle = desiredAngle
script.Parent.F.Rotation = -math.deg(a)
end
while true do
vel.Value = target.Velocity
wait() --REQUIRED while loop
pvel.Value = vel.Value
vel.Value = target.Velocity
local diff = script.Parent.Diff
diff.Value = ((pvel.Value-vel.Value) * sensitivity)
local xz = ((diff.Value.X)/4)
xz = math.min(xz,.5) xz = math.max(xz,-.5)
local yz = ((diff.Value.Z)/4)
yz = math.min(yz,.5) yz = math.max(yz,-.5)
Rotate()
script.Parent.F.Dot.Position = UDim2.new(-xz+.5,-8,(-yz)+.5,-8)
local mag = Vector2.new(diff.Value.X/2,diff.Value.Z/2).Magnitude
if mag < min then mag = 0 end
script.Parent.TL.Text = math.floor(math.min(mag,max)*100)/100 .. " G"
end
|
--[[Front]]
|
--
Tune.FTireProfile = 1.5 -- Tire profile, aggressive or smooth
Tune.FProfileHeight = 2 -- Profile height, conforming to tire
Tune.FTireCompound = 1 -- The more compounds you have, the harder your tire will get towards the middle, sacrificing grip for wear
Tune.FTireFriction = 1.1 -- Your tire's friction in the best conditions.
|
--// Holstering
|
HolsteringEnabled = true;
HolsterPos = CFrame.new(0.140751064, 0, -0.616261482, -4.10752676e-08, -0.342020065, 0.939692616, -1.49501727e-08, 0.939692557, 0.342020094, -0.99999994, 0, -4.37113847e-08);
|
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare
]]
|
local FE = workspace.FilteringEnabled
local car = script.Parent.Car.Value
local handler = car:WaitForChild("AC6_FE_Sounds")
local _Tune = require(car["A-Chassis Tune"])
local on = 0
local throt=0
local PeakRPM=0
script:WaitForChild("Rev")
for i,v in pairs(car.DriveSeat:GetChildren()) do
for _,a in pairs(script:GetChildren()) do
if v.Name==a.Name then v:Stop() wait() v:Destroy() end
end
end
handler:FireServer("newSound","Rev",car.DriveSeat,script.Rev.SoundId,0,script.Rev.Volume,true)
handler:FireServer("playSound","Rev")
car.DriveSeat:WaitForChild("Rev")
while wait() do
local _RPM = script.Parent.Values.RPM.Value
if script.Parent.Values.Throttle.Value <= _Tune.IdleThrottle/100 then
throt = math.max(.3,throt-.2)
else
throt = math.min(1,throt+.1)
end
if script.Parent.Values.RPM.Value > _Tune.PeakRPM-_Tune.RevBounce/4 and script.Parent.Values.Throttle.Value > _Tune.IdleThrottle/100 then
PeakRPM=.5
else
PeakRPM=1
end
if not script.Parent.IsOn.Value then on=math.max(on-.015,0) else on=1 end
local Pitch = math.max((((script.Rev.SetPitch.Value + script.Rev.SetRev.Value*_RPM/_Tune.PeakRPM))*on^2),script.Rev.SetPitch.Value)
if FE then
handler:FireServer("updateSound","Rev",script.Rev.SoundId,Pitch,script.Rev.Volume)
else
car.DriveSeat.Rev.Pitch = Pitch
end
end
|
--[[
TableUtil.Copy(tbl: table): table
TableUtil.CopyShallow(tbl: table): table
TableUtil.Sync(tbl: table, template: table): void
TableUtil.FastRemove(tbl: table, index: number): void
TableUtil.FastRemoveFirstValue(tbl: table, value: any): (boolean, number)
TableUtil.Map(tbl: table, callback: (value: any) -> any): table
TableUtil.Filter(tbl: table, callback: (value: any) -> boolean): table
TableUtil.Reduce(tbl: table, callback: (accum: any, value: any) -> any [, initialValue: any]): any
TableUtil.Assign(target: table, ...sources: table): table
TableUtil.Extend(tbl: table, extension: table): table
TableUtil.Reverse(tbl: table): table
TableUtil.Shuffle(tbl: table [, rng: Random]): table
TableUtil.Sample(tbl: table, sampleSize: number, [, rng: Random]): table
TableUtil.Flat(tbl: table [, maxDepth: number = 1]): table
TableUtil.FlatMap(tbl: callback: (value: any) -> table): table
TableUtil.Keys(tbl: table): table
TableUtil.Find(tbl: table, callback: (value: any) -> boolean): (any, number)
TableUtil.Every(tbl: table, callback: (value: any) -> boolean): boolean
TableUtil.Some(tbl: table, callback: (value: any) -> boolean): boolean
TableUtil.Truncate(tbl: table, length: number): table
TableUtil.Zip(...table): ((table, any) -> (any, any), table, any)
TableUtil.IsEmpty(tbl: table): boolean
TableUtil.EncodeJSON(tbl: table): string
TableUtil.DecodeJSON(json: string): table
--]]
|
type Table = {any}
type MapPredicate = (any, any, Table) -> any
type FilterPredicate = (any, any, Table) -> boolean
type ReducePredicate = (number, any, any, Table) -> number
type FindCallback = (any, any, Table) -> boolean
type IteratorFunc = (t: Table, k: any) -> (any, any)
local TableUtil = {}
local HttpService = game:GetService("HttpService")
local rng = Random.new()
local function CopyTable(t: Table): Table
assert(type(t) == "table", "First argument must be a table")
local function Copy(tbl)
local tCopy = table.create(#tbl)
for k,v in pairs(tbl) do
if type(v) == "table" then
tCopy[k] = Copy(v)
else
tCopy[k] = v
end
end
return tCopy
end
return Copy(t)
end
local function CopyTableShallow(t: Table): Table
local tCopy = table.create(#t)
if #t > 0 then
table.move(t, 1, #t, 1, tCopy)
else
for k,v in pairs(t) do tCopy[k] = v end
end
return tCopy
end
local function Sync(srcTbl: Table, templateTbl: Table): Table
assert(type(srcTbl) == "table", "First argument must be a table")
assert(type(templateTbl) == "table", "Second argument must be a table")
local tbl = CopyTableShallow(srcTbl)
-- If 'tbl' has something 'templateTbl' doesn't, then remove it from 'tbl'
-- If 'tbl' has something of a different type than 'templateTbl', copy from 'templateTbl'
-- If 'templateTbl' has something 'tbl' doesn't, then add it to 'tbl'
for k,v in pairs(tbl) do
local vTemplate = templateTbl[k]
-- Remove keys not within template:
if vTemplate == nil then
tbl[k] = nil
-- Synchronize data types:
elseif type(v) ~= type(vTemplate) then
if type(vTemplate) == "table" then
tbl[k] = CopyTable(vTemplate)
else
tbl[k] = vTemplate
end
-- Synchronize sub-tables:
elseif type(v) == "table" then
tbl[k] = Sync(v, vTemplate)
end
end
-- Add any missing keys:
for k,vTemplate in pairs(templateTbl) do
local v = tbl[k]
if v == nil then
if type(vTemplate) == "table" then
tbl[k] = CopyTable(vTemplate)
else
tbl[k] = vTemplate
end
end
end
return tbl
end
local function FastRemove(t: Table, i: number)
local n = #t
t[i] = t[n]
t[n] = nil
end
local function FastRemoveFirstValue(t: Table, v: any): (boolean, number?)
local index: number? = table.find(t, v)
if index then
FastRemove(t, index)
return true, index
end
return false, nil
end
local function Map(t: Table, f: MapPredicate): Table
assert(type(t) == "table", "First argument must be a table")
assert(type(f) == "function", "Second argument must be a function")
local newT = table.create(#t)
for k,v in pairs(t) do
newT[k] = f(v, k, t)
end
return newT
end
local function Filter(t: Table, f: FilterPredicate): Table
assert(type(t) == "table", "First argument must be a table")
assert(type(f) == "function", "Second argument must be a function")
local newT = table.create(#t)
if #t > 0 then
local n = 0
for i,v in ipairs(t) do
if f(v, i, t) then
n += 1
newT[n] = v
end
end
else
for k,v in pairs(t) do
if f(v, k, t) then
newT[k] = v
end
end
end
return newT
end
local function Reduce(t: Table, f: ReducePredicate, init: any?): any
assert(type(t) == "table", "First argument must be a table")
assert(type(f) == "function", "Second argument must be a function")
local result = init
if #t > 0 then
local start = 1
if init == nil then
result = t[1]
start = 2
end
for i = start,#t do
result = f(result, t[i], i, t)
end
else
local start = nil
if init == nil then
result = next(t)
start = result
end
for k,v in next,t,start do
result = f(result, v, k, t)
end
end
return result
end
local function Assign(target: Table, ...: Table): Table
local tbl = CopyTableShallow(target)
for _,src in ipairs({...}) do
for k,v in pairs(src) do
tbl[k] = v
end
end
return tbl
end
local function Extend(target: Table, extension: Table): Table
local tbl = CopyTableShallow(target)
for _,v in ipairs(extension) do
table.insert(tbl, v)
end
return tbl
end
local function Reverse(tbl: Table): Table
local n = #tbl
local tblRev = table.create(n)
for i = 1,n do
tblRev[i] = tbl[n - i + 1]
end
return tblRev
end
local function Shuffle(tbl: Table, rngOverride: Random?): Table
assert(type(tbl) == "table", "First argument must be a table")
local shuffled = CopyTableShallow(tbl)
local random = rngOverride or rng
for i = #tbl, 2, -1 do
local j = random:NextInteger(1, i)
shuffled[i], shuffled[j] = shuffled[j], shuffled[i]
end
return shuffled
end
local function Sample(tbl: Table, size: number, rngOverride: Random?): Table
assert(type(tbl) == "table", "First argument must be a table")
assert(type(size) == "number", "Second argument must be a number")
local shuffled = CopyTableShallow(tbl)
local sample = table.create(size)
local random = rngOverride or rng
local len = #tbl
size = math.clamp(size, 1, len)
for i = 1,size do
local j = random:NextInteger(i, len)
shuffled[i], shuffled[j] = shuffled[j], shuffled[i]
end
table.move(shuffled, 1, size, 1, sample)
return sample
end
local function Flat(tbl: Table, depth: number?): Table
local maxDepth: number = depth or 1
local flatTbl = table.create(#tbl)
local function Scan(t: Table, d: number)
for _,v in ipairs(t) do
if type(v) == "table" and d < maxDepth then
Scan(v, d + 1)
else
table.insert(flatTbl, v)
end
end
end
Scan(tbl, 0)
return flatTbl
end
local function FlatMap(tbl: Table, callback: MapPredicate): Table
return Flat(Map(tbl, callback))
end
local function Keys(tbl: Table): Table
local keys = table.create(#tbl)
for k in pairs(tbl) do
table.insert(keys, k)
end
return keys
end
local function Find(tbl: Table, callback: FindCallback): (any?, any?)
for k,v in pairs(tbl) do
if callback(v, k, tbl) then
return v, k
end
end
return nil, nil
end
local function Every(tbl: Table, callback: FindCallback): boolean
for k,v in pairs(tbl) do
if not callback(v, k, tbl) then
return false
end
end
return true
end
local function Some(tbl: Table, callback: FindCallback): boolean
for k,v in pairs(tbl) do
if callback(v, k, tbl) then
return true
end
end
return false
end
local function Truncate(tbl: Table, len: number): Table
return table.move(tbl, 1, len, 1, table.create(len))
end
local function Zip(...): (IteratorFunc, Table, any)
assert(select("#", ...) > 0, "Must supply at least 1 table")
local function ZipIteratorArray(all: Table, k: number)
k += 1
local values = {}
for i,t in ipairs(all) do
local v = t[k]
if v ~= nil then
values[i] = v
else
return nil, nil
end
end
return k, values
end
local function ZipIteratorMap(all: Table, k: any)
local values = {}
for i,t in ipairs(all) do
local v = next(t, k)
if v ~= nil then
values[i] = v
else
return nil, nil
end
end
return k, values
end
local all = {...}
if #all[1] > 0 then
return ZipIteratorArray, all, 0
else
return ZipIteratorMap, all, nil
end
end
local function IsEmpty(tbl)
return next(tbl) == nil
end
local function EncodeJSON(tbl: any): string
return HttpService:JSONEncode(tbl)
end
local function DecodeJSON(str: string): any
return HttpService:JSONDecode(str)
end
local function DeepFreeze( tab: {} ): ()
assert(type(tab) == "table", "First argument must be a table")
for _, value: any in pairs( tab ) do
if ( typeof(value) == "table" ) then
DeepFreeze( value )
end
end
table.freeze( tab )
end
TableUtil.Copy = CopyTable
TableUtil.CopyShallow = CopyTableShallow
TableUtil.Sync = Sync
TableUtil.FastRemove = FastRemove
TableUtil.FastRemoveFirstValue = FastRemoveFirstValue
TableUtil.Map = Map
TableUtil.Filter = Filter
TableUtil.Reduce = Reduce
TableUtil.Assign = Assign
TableUtil.Extend = Extend
TableUtil.Reverse = Reverse
TableUtil.Shuffle = Shuffle
TableUtil.Sample = Sample
TableUtil.Flat = Flat
TableUtil.FlatMap = FlatMap
TableUtil.Keys = Keys
TableUtil.Find = Find
TableUtil.Every = Every
TableUtil.Some = Some
TableUtil.Truncate = Truncate
TableUtil.Zip = Zip
TableUtil.IsEmpty = IsEmpty
TableUtil.EncodeJSON = EncodeJSON
TableUtil.DecodeJSON = DecodeJSON
TableUtil.DeepFreeze = DeepFreeze
return TableUtil
|
-- This file implements a wrapper function for TextService:GetTextSize()
-- Extra padding is added to the returned size because of a rounding issue with GetTextSize
-- TODO: Remove this temporary additional padding when CLIPLAYEREX-1633 is fixed
|
local TextService = game:GetService("TextService")
local TEMPORARY_TEXT_SIZE_PADDING = Vector2.new(2, 2)
local function getTextSize(...)
local textSize = TextService:GetTextSize(...)
return textSize + TEMPORARY_TEXT_SIZE_PADDING
end
return getTextSize
|
-----------------
--| Constants |--
-----------------
|
local GRAVITY_ACCELERATION = workspace.Gravity
local RELOAD_TIME = 0 -- Seconds until tool can be used again
local ROCKET_SPEED = 100 -- Speed of the projectile
local MISSILE_MESH_ID = 'http://www.roblox.com/asset/?id=2251534'
local MISSILE_MESH_SCALE = Vector3.new(0.35, 0.35, 0.25)
local ROCKET_PART_SIZE = Vector3.new(1.2, 1.2, 3.27)
|
-- Connections
|
RedeemCode.OnServerEvent:Connect(handleCodeRedemption)
|
--[=[
@param data table
@return Option
Deserializes the data into an Option. This data should have come from
the `option:Serialize()` method.
]=]
|
function Option.Deserialize(data) -- type data = {ClassName: string, Value: any}
assert(type(data) == "table" and data.ClassName == CLASSNAME, "Invalid data for deserializing Option")
return data.Value == nil and Option.None or Option.Some(data.Value)
end
|
--{HPattern, Automatic, DualClutch, CVT}
|
if script.Parent.Storage.EngineType.Value ~= "Electric" then
if script.Parent.Storage.TransmissionType.Value == "HPattern" then
if currentgear.Value == 3 and clutch.Value == true then
--script.Parent.Storage.AutoClutch.Value = true
else
--script.Parent.Storage.AutoClutch.Value = false
end
elseif script.Parent.Storage.TransmissionType.Value == "Automatic" then
elseif script.Parent.Storage.TransmissionType.Value == "DualClutch" then
elseif script.Parent.Storage.TransmissionType.Value == "CVT" then
vvv = 0.034
vt = 0.7
if rpm.Value >= 5000*convert and throttle.Value >= 1 then
if gear1.Value > 0.7 and speed > 40 then
gear1.Value = gear1.Value - 0.02*(2-(speed/130))
elseif gear1.Value < 0.5 then
gear1.Value = 0.5
end
elseif rpm.Value <= 4900*convert then
if gear1.Value > 4 then
gear1.Value = 4
else
gear1.Value = gear1.Value + 0.028*(2-(speed/130))
end
end
end
end
if carSeat.Throttle == -1 then
drive = speed/1.298
else
if carSeat.Dyno.Value == false then
if script.Parent.Storage.Drivetrain.Value == "RWD" then
drive =
(carSeat.Parent.Parent.Wheels.FL.Wheel.RotVelocity.Magnitude/8)+
(carSeat.Parent.Parent.Wheels.FR.Wheel.RotVelocity.Magnitude/8)+
(carSeat.Parent.Parent.Wheels.FL.Wheel.RotVelocity.Magnitude/8)+
(carSeat.Parent.Parent.Wheels.FR.Wheel.RotVelocity.Magnitude/8)+
(carSeat.Parent.Parent.Wheels.FL.Wheel.RotVelocity.Magnitude/8)+
(carSeat.Parent.Parent.Wheels.FR.Wheel.RotVelocity.Magnitude/8)+
(carSeat.Parent.Parent.Wheels.RL.Wheel.RotVelocity.Magnitude/8)+
(carSeat.Parent.Parent.Wheels.RR.Wheel.RotVelocity.Magnitude/8)
orderch = ((carSeat.Parent.Parent.Wheels.RL.Wheel.RotVelocity.Magnitude + carSeat.Parent.Parent.Wheels.RR.Wheel.RotVelocity.Magnitude)/2)*1.298
TC = rt
torquesplit.Value = 100
elseif script.Parent.Storage.Drivetrain.Value == "FWD" then
drive =
(carSeat.Parent.Parent.Wheels.RL.Wheel.RotVelocity.Magnitude/2)+
(carSeat.Parent.Parent.Wheels.RR.Wheel.RotVelocity.Magnitude/2)
orderch = ((carSeat.Parent.Parent.Wheels.FL.Wheel.RotVelocity.Magnitude + carSeat.Parent.Parent.Wheels.FR.Wheel.RotVelocity.Magnitude)/2)*1.298
torquesplit.Value = 0
TC = ft
elseif script.Parent.Storage.Drivetrain.Value == "AWD" then
drive =
(carSeat.Parent.Parent.Wheels.FL.Wheel.RotVelocity.Magnitude/2)+
(carSeat.Parent.Parent.Wheels.FR.Wheel.RotVelocity.Magnitude/2)
orderch = ((carSeat.Parent.Parent.Wheels.FL.Wheel.RotVelocity.Magnitude + carSeat.Parent.Parent.Wheels.FR.Wheel.RotVelocity.Magnitude + carSeat.Parent.Parent.Wheels.RL.Wheel.RotVelocity.Magnitude + carSeat.Parent.Parent.Wheels.RR.Wheel.RotVelocity.Magnitude)/4)*1.298
TC = (rt+ft)/2
end
else
if script.Parent.Storage.Drivetrain.Value == "RWD" then
drive =
(carSeat.Parent.Parent.Wheels.RL.Wheel.RotVelocity.Magnitude/2)+
(carSeat.Parent.Parent.Wheels.RR.Wheel.RotVelocity.Magnitude/2)
elseif script.Parent.Storage.Drivetrain.Value == "FWD" then
drive =
(carSeat.Parent.Parent.Wheels.FL.Wheel.RotVelocity.Magnitude/2)+
(carSeat.Parent.Parent.Wheels.FR.Wheel.RotVelocity.Magnitude/2)
elseif script.Parent.Storage.Drivetrain.Value == "AWD" then
drive =
(carSeat.Parent.Parent.Wheels.FL.Wheel.RotVelocity.Magnitude/4)+
(carSeat.Parent.Parent.Wheels.FR.Wheel.RotVelocity.Magnitude/4)+(carSeat.Parent.Parent.Wheels.RL.Wheel.RotVelocity.Magnitude/4)+
(carSeat.Parent.Parent.Wheels.RR.Wheel.RotVelocity.Magnitude/4)
end
end
end
xxx = (gear[currentgear.Value]/final.Value)*(111)
ovo = (gear[currentgear.Value]/final.Value)*1.5
trans.Value = drive
if currentgear.Value ~= 1 then
x1x = (gear[(currentgear.Value-1)]/final.Value)*(111)
xx1 = (gear[(currentgear.Value+1)]/final.Value)*(111)
else
x1x = 1
end
tran = clutch.Clutch.Value
wheelrpm = trans.Value*xxx
four = (gear[currentgear.Value]/final.Value)
if script.Parent.Functions.ShiftDownRequested.Value ~= true and script.Parent.Functions.ShiftUpRequested.Value ~= true then
rpm.Value = (engine.Value*(1-tran))+(tran*wheelrpm)
end
checkcluch = clutch.Clutch.Value
if clutch.Value == true then
CT = 1
else
CT = 0
end
|
--edit the function below to return true when you want this response/prompt to be valid
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data
|
return function(player, dialogueFolder)
local ClassInformationTable = require(game.ReplicatedStorage.Source.Modules.CharacterScripts.Classes.ClassInformation)
return ClassInformationTable:GetClassFolder(player,"Paladin").XP.Value >= 1000
end
|
-- else
-- if script.Parent.Parent.Self_Destruction_Panel.Opened.Value then
-- script.Parent.Parent.Self_Destruction_Panel.Open:Fire()
-- end
|
end
end
script.Parent.Lever1.Pulled.Changed:Connect(Changed)
script.Parent.Lever2.Pulled.Changed:Connect(Changed)
script.Parent.Lever3.Pulled.Changed:Connect(Changed)
script.Parent.Lever4.Pulled.Changed:Connect(Changed)
|
-- Local Variables
|
local StartTime = 0
local Duration = 0
|
-- print(index, this, surfaces[this], -(#surfaces-index)+this, surfaces[-(#surfaces-index)+this])
|
table.insert(labels,
root:FindFirstChild(surfaces[this] or surfaces[this%#surfaces], true).Frame.TextLabel
)
end
return labels
end
while wait() do
for index,name in pairs(surfaces) do
local labelAs = GetPreceedingLabels(index)
local labelM = root:FindFirstChild(name, true).Frame.TextLabel
local labelBs = GetSucceedingLabels(index)
|
-- CONSTANTS
|
local GuiLib = script.Parent.Parent
local Lazy = require(GuiLib:WaitForChild("LazyLoader"))
local Defaults = GuiLib:WaitForChild("Defaults")
local CHECKBOX_LABEL = Defaults:WaitForChild("CheckboxLabel")
|
-- Hitpoints for each enemy; one blaster shot takes 35 hitpoints
|
GameSettings.EnemyHealthDifficulty = {
Easy = 60,
Normal = 105,
Hard = 140
}
|
-- Find the local player if they're already in the game
|
local localPlayer = Players.LocalPlayer
if localPlayer then
handlePlayerAdded(localPlayer)
end
|
-- child.C0 = CFrame.new(0,-0.6,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0) --// Reposition player
|
if child.Part1.Name == "HumanoidRootPart" then
player = game.Players:GetPlayerFromCharacter(child.Part1.Parent)
if player and (not player.PlayerGui:FindFirstChild("Screen")) then --// The part after the "and" prevents multiple GUI's to be copied over.
GUI.CarSeat.Value = script.Parent --// Puts a reference of the seat in this ObjectValue, now you can use this ObjectValue's value to find the car directly.
GUI:Clone().Parent = player.PlayerGui --// Compact version
if script.Parent.L.Value == true then --because you can't get in a locked car
wait()
script.Parent.Disabled = true
wait()
script.Parent.Disabled = false
end
if workspace.FilteringEnabled == true then
script.Parent.Parent.Body.Dash.Screen2.G.FE.TextColor3 = Color3.new(0,1,0)
else
script.Parent.Parent.Body.Dash.Screen2.G.FE.TextColor3 = Color3.new(1,0,0)
end
if workspace:PGSIsEnabled() then
script.Parent.Parent.Body.Dash.Screen2.G.PGS.TextColor3 = Color3.new(0,1,0)
else
script.Parent.Parent.Body.Dash.Screen2.G.PGS.TextColor3 = Color3.new(1,0,0)
end
script.Parent.Occupied.Value = true
script.Parent.Parent.Body.Lights.Runner.Material = "Neon"
script.Parent.Parent.Body.Dash.Screen.G.Enabled = true
script.Parent.Parent.Body.Dash.Screen2.G.Enabled = true
script.Parent.Parent.DriveSeat.SS3.DashInfoSpeed.Info.Value = true
script.Parent.Parent.DriveSeat.SS3.DashInfoSpeed.Speed.Value = false
script.Parent.Parent.DriveSeat.SS3.DashInfoSpeed.Version.Value = false
script.Parent.Parent.DriveSeat.SS3.DashInfoSpeed.MPG.Value = false
script.Parent.Parent.DriveSeat.SS3.Radios.FMOne.Value = true
script.Parent.Parent.DriveSeat.SS3.Radios.FMTwo.Value = false
script.Parent.Parent.DriveSeat.SS3.Radios.FMThree.Value = false
script.Parent.Parent.DriveSeat.SS3.Radios.FMFour.Value = false
end
end
end
end)
script.Parent.ChildRemoved:connect(function(child)
if child:IsA("Weld") then
if child.Part1.Name == "HumanoidRootPart" then
game.Workspace.CurrentCamera.FieldOfView = 70
player = game.Players:GetPlayerFromCharacter(child.Part1.Parent)
if player and player.PlayerGui:FindFirstChild("SS3") then
player.PlayerGui:FindFirstChild("SS3"):Destroy()
script.Parent.Parent.Body.Dash.Screen.G.Enabled = false
script.Parent.Parent.Body.Dash.Screen2.G.Enabled = false
script.Parent.Parent.Body.Lights.Runner.Material = "SmoothPlastic"
script.Parent.Occupied.Value = false
end
end
end
end)
|
--< Start
|
redeem.MouseButton1Click:Connect(Redeem)
|
-- Functions
|
local JsonDecode = function(s) return HttpService:JSONDecode(s) end
local function GetApiRemoteFunction(index)
if (apiChunks[index]) then
return apiChunks[index], #apiChunks
else
print("Bad index for GetApiJson")
return nil
end
end
local function getApiJson()
local apiTable = {}
local firstPage, pageCount = GetApiRemoteFunction(1)
table.insert(apiTable, firstPage)
for i = 2, pageCount do
--print("Fetching API page # " .. tostring(i))
local result = GetApiRemoteFunction(i)
table.insert(apiTable, result)
end
return table.concat(apiTable)
end
local json = getApiJson()
local apiDump = JsonDecode(json)
local Classes = {}
local Enums = {}
local function sortAlphabetic(t, property)
table.sort(t,
function(x,y) return x[property] < y[property]
end)
end
local function isEnum(name)
return Enums[name] ~= nil
end
local function getProperties(className)
local class = Classes[className]
local properties = {}
if not class then return properties end
while class do
for _,property in pairs(class.Properties) do
table.insert(properties, property)
end
class = Classes[class.Superclass]
end
sortAlphabetic(properties, "Name")
return properties
end
for _,item in pairs(apiDump) do
local itemType = item.type
|
--[[**
Gets whatever object is stored with the given index, if it exists. This was added since Maid allows getting the task using `__index`.
@param [t:any] Index The index that the object is stored under.
@returns [t:any?] This will return the object if it is found, but it won't return anything if it doesn't exist.
**--]]
|
function Janitor.__index:Get(Index)
local This = self[IndicesReference]
if This then
return This[Index]
else
return nil
end
end
|
--[[
Updates all Spring objects.
]]
|
local function updateAllSprings(timeStep: number)
for damping, dampingBucket in pairs(springBuckets) do
for speed, speedBucket in pairs(dampingBucket) do
local posPosCoef, posVelCoef, velPosCoef, velVelCoef = springCoefficients(timeStep, damping, speed)
for spring in pairs(speedBucket) do
local goals = spring._springGoals
local positions = spring._springPositions
local velocities = spring._springVelocities
local isMoving = false
for index, goal in ipairs(goals) do
local oldPosition = positions[index]
local oldVelocity = velocities[index]
local oldDisplacement = oldPosition - goal
local newDisplacement = oldDisplacement * posPosCoef + oldVelocity * posVelCoef
local newVelocity = oldDisplacement * velPosCoef + oldVelocity * velVelCoef
if
math.abs(newDisplacement) > MOVEMENT_EPSILON or
math.abs(newVelocity) > MOVEMENT_EPSILON
then
isMoving = true
end
positions[index] = newDisplacement + goal
velocities[index] = newVelocity
end
-- if the spring moved a significant distance, update its
-- current value, otherwise stop animating
if isMoving then
spring._currentValue = packType(positions, spring._currentType)
updateAll(spring)
else
SpringScheduler.remove(spring)
end
end
end
end
end
RunService:BindToRenderStep(
"__FusionSpringScheduler",
Enum.RenderPriority.First.Value,
updateAllSprings
)
return SpringScheduler
|
--Input Handler
|
function DealWithInput(input,IsRobloxFunction)
if (UserInputService:GetFocusedTextBox()==nil) and not _InControls then --Ignore when UI Focus
--Shift Down [Manual Transmission]
if _IsOn and (input.KeyCode ==_CTRL["ContlrShiftDown"] or (_MSteer and input.KeyCode==_CTRL["MouseShiftDown"]) or ((not _MSteer) and input.KeyCode==_CTRL["ShiftDown"])) and ((_TMode=="Auto" and _CGear<=1) or _TMode=="Semi" or (_TMode=="Manual" and (not _ClutchOn))) and input.UserInputState == Enum.UserInputState.Begin then
if _CGear == 0 then _ClutchOn = true end
if (_CGear ~= 0 and (_CGear ~= ((#_Tune.Ratios-3)-(#_Tune.Ratios-2)))) and _TMode=="Semi" then
_GThrotShift = 0
wait(_Tune.ShiftTime/2)
_GThrotShift = 1
end
_CGear = math.max(_CGear-1,-1)
if not _TMode=="Manual" then _ClutchOn = true end
--Shift Up [Manual Transmission]
elseif _IsOn and (input.KeyCode ==_CTRL["ContlrShiftUp"] or (_MSteer and input.KeyCode==_CTRL["MouseShiftUp"]) or ((not _MSteer) and input.KeyCode==_CTRL["ShiftUp"])) and ((_TMode=="Auto" and _CGear<1) or _TMode=="Semi" or (_TMode=="Manual" and (not _ClutchOn))) and input.UserInputState == Enum.UserInputState.Begin then
if _CGear == 0 then _ClutchOn = true end
if ((_CGear ~= 0) and (_CGear ~= #_Tune.Ratios-2)) and _TMode=="Semi" then
_GThrotShift = 0
wait(_Tune.ShiftTime)
_GThrotShift = 1
end
_CGear = math.min(_CGear+1,#_Tune.Ratios-2)
if not _TMode=="Manual" then _ClutchOn = true end
--Toggle Clutch
elseif _IsOn and (input.KeyCode ==_CTRL["ContlrClutch"] or (_MSteer and input.KeyCode==_CTRL["MouseClutch"]) or ((not _MSteer) and input.KeyCode==_CTRL["Clutch"])) and _TMode=="Manual" then
if input.UserInputState == Enum.UserInputState.Begin then
_ClutchOn = false
_ClPressing = true
elseif input.UserInputState == Enum.UserInputState.End then
_ClutchOn = true
_ClPressing = false
end
--Toggle PBrake
elseif _IsOn and input.KeyCode ==_CTRL["ContlrPBrake"] or (_MSteer and input.KeyCode==_CTRL["MousePBrake"]) or ((not _MSteer) and input.KeyCode==_CTRL["PBrake"]) then
if input.UserInputState == Enum.UserInputState.Begin then
_PBrake = not _PBrake
elseif input.UserInputState == Enum.UserInputState.End then
if car.DriveSeat.Velocity.Magnitude>5 then _PBrake = false end
end
--Toggle Transmission Mode
elseif (input.KeyCode == _CTRL["ContlrToggleTMode"] or input.KeyCode==_CTRL["ToggleTransMode"]) and input.UserInputState == Enum.UserInputState.Begin then
local n=1
for i,v in pairs(_Tune.TransModes) do
if v==_TMode then n=i break end
end
n=n+1
if n>#_Tune.TransModes then n=1 end
_TMode = _Tune.TransModes[n]
--Throttle
elseif _IsOn and ((not _MSteer) and (input.KeyCode==_CTRL["Throttle"] or input.KeyCode == _CTRL["Throttle2"])) or ((((_CTRL["MouseThrottle"]==Enum.UserInputType.MouseButton1 or _CTRL["MouseThrottle"]==Enum.UserInputType.MouseButton2) and input.UserInputType == _CTRL["MouseThrottle"]) or input.KeyCode == _CTRL["MouseThrottle"])and _MSteer) then
if input.UserInputState == Enum.UserInputState.Begin then
_GThrot = 1
else
_GThrot = _Tune.IdleThrottle/100
end
--Brake
elseif ((not _MSteer) and (input.KeyCode==_CTRL["Brake"] or input.KeyCode == _CTRL["Brake2"])) or ((((_CTRL["MouseBrake"]==Enum.UserInputType.MouseButton1 or _CTRL["MouseBrake"]==Enum.UserInputType.MouseButton2) and input.UserInputType == _CTRL["MouseBrake"]) or input.KeyCode == _CTRL["MouseBrake"])and _MSteer) then
if input.UserInputState == Enum.UserInputState.Begin then
_GBrake = 1
else
_GBrake = 0
end
--Steer Left
elseif (not _MSteer) and (input.KeyCode==_CTRL["SteerLeft"] or input.KeyCode == _CTRL["SteerLeft2"]) then
if input.UserInputState == Enum.UserInputState.Begin then
_GSteerT = -1
_SteerL = true
else
if _SteerR then
_GSteerT = 1
else
_GSteerT = 0
end
_SteerL = false
end
--Steer Right
elseif (not _MSteer) and (input.KeyCode==_CTRL["SteerRight"] or input.KeyCode == _CTRL["SteerRight2"]) then
if input.UserInputState == Enum.UserInputState.Begin then
_GSteerT = 1
_SteerR = true
else
if _SteerL then
_GSteerT = -1
else
_GSteerT = 0
end
_SteerR = false
end
--Toggle Mouse Controls
elseif input.KeyCode ==_CTRL["ToggleMouseDrive"] then
if input.UserInputState == Enum.UserInputState.End then
_MSteer = not _MSteer
_GThrot = _Tune.IdleThrottle/100
_GBrake = 0
_GSteerT = 0
_ClutchOn = true
end
--Toggle TCS
elseif _Tune.TCSEnabled and _IsOn and input.KeyCode == _CTRL["ToggleTCS"] or input.KeyCode == _CTRL["ContlrToggleTCS"] then
if input.UserInputState == Enum.UserInputState.End then _TCS = not _TCS end
--Toggle ABS
elseif _Tune.ABSEnabled and _IsOn and input.KeyCode == _CTRL["ToggleABS"] or input.KeyCode == _CTRL["ContlrToggleABS"] then
if input.UserInputState == Enum.UserInputState.End then _ABS = not _ABS end
end
--Variable Controls
if input.UserInputType.Name:find("Gamepad") then
--Gamepad Steering
if input.KeyCode == _CTRL["ContlrSteer"] then
if input.Position.X>= 0 then
local cDZone = math.min(.99,_Tune.Peripherals.ControlRDZone/100)
if math.abs(input.Position.X)>cDZone then
_GSteerT = (input.Position.X-cDZone)/(1-cDZone)
else
_GSteerT = 0
end
else
local cDZone = math.min(.99,_Tune.Peripherals.ControlLDZone/100)
if math.abs(input.Position.X)>cDZone then
_GSteerT = (input.Position.X+cDZone)/(1-cDZone)
else
_GSteerT = 0
end
end
--Gamepad Throttle
elseif _IsOn and input.KeyCode == _CTRL["ContlrThrottle"] then
_GThrot = math.max(_Tune.IdleThrottle/100,input.Position.Z)
--Gamepad Brake
elseif input.KeyCode == _CTRL["ContlrBrake"] then
_GBrake = input.Position.Z
end
end
else
_GThrot = _Tune.IdleThrottle/100
_GSteerT = 0
_GBrake = 0
if _CGear~=0 then _ClutchOn = true end
end
end
UserInputService.InputBegan:connect(DealWithInput)
UserInputService.InputChanged:connect(DealWithInput)
UserInputService.InputEnded:connect(DealWithInput)
|
-- order is important because SSF could auto orchestrate which would require conductor to already be called
|
require(EventSequencer.Conductor)()
require(EventSequencer.ServerSceneFramework)()
|
--Incline Compensation
|
Tune.InclineComp = 90 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
|
-- Cleans up all the handles in the state
|
function BaseState:Destroy()
for _, handle in pairs(self.handles) do
handle:Disconnect()
end
end
|
-- types
|
export type BezierPoint = {
Type: string;
Point: Vector3 | BasePart;
}
|
--[=[
Removes all attributes from an instance.
@param instance Instance
]=]
|
function AttributeUtils.removeAllAttributes(instance: Instance)
assert(typeof(instance) == "Instance", "Bad instance")
for key, _ in pairs(instance:GetAttributes()) do
instance:SetAttribute(key, nil)
end
end
return AttributeUtils
|
--[[Brakes]]
|
Tune.ABSEnabled = true -- Implements ABS
Tune.ABSThreshold = 20 -- Slip speed allowed before ABS starts working (in SPS)
Tune.FBrakeForce = 2000 -- Front brake force
Tune.RBrakeForce = 1500 -- Rear brake force
Tune.PBrakeForce = 5500 -- Handbrake force
Tune.FLgcyBForce = 20000 -- Front brake force [PGS OFF]
Tune.RLgcyBForce = 15000 -- Rear brake force [PGS OFF]
Tune.LgcyPBForce = 25000 -- Handbrake force [PGS OFF]
|
--[[**
<description>
Run this once to combine all keys provided into one "main key".
Internally, this means that data will be stored in a table with the key mainKey.
This is used to get around the 2-DataStore2 reliability caveat.
</description>
<parameter name = "mainKey">
The key that will be used to house the table.
</parameter>
<parameter name = "...">
All the keys to combine under one table.
</parameter>
**--]]
|
function DataStore2.Combine(mainKey, ...)
for _, name in ipairs({...}) do
combinedDataStoreInfo[name] = mainKey
end
end
function DataStore2.ClearCache()
DataStoreCache = {}
end
function DataStore2.SaveAll(Player)
if DataStoreCache[Player] then
for _, dataStore in pairs(DataStoreCache[Player]) do
if dataStore.combinedStore == nil then
dataStore:Save()
end
end
end
end
DataStore2.SaveAllAsync = Promise.promisify(DataStore2.SaveAll)
function DataStore2.PatchGlobalSettings(patch)
for key, value in pairs(patch) do
assert(Settings[key] ~= nil, "No such key exists: " .. key)
-- TODO: Implement type checking with this when osyris' t is in
Settings[key] = value
end
end
function DataStore2.__call(_, dataStoreName, Player)
assert(
typeof(dataStoreName) == "string" and IsPlayer.Check(Player),
("DataStore2() API call expected {string dataStoreName, Player Player}, got {%s, %s}")
:format(
typeof(dataStoreName),
typeof(Player)
)
)
if DataStoreCache[Player] and DataStoreCache[Player][dataStoreName] then
return DataStoreCache[Player][dataStoreName]
elseif combinedDataStoreInfo[dataStoreName] then
local dataStore = DataStore2(combinedDataStoreInfo[dataStoreName], Player)
dataStore:BeforeSave(function(combinedData)
for key in pairs(combinedData) do
if combinedDataStoreInfo[key] then
local combinedStore = DataStore2(key, Player)
local value = combinedStore:Get(nil, true)
if value ~= nil then
if combinedStore.combinedBeforeSave then
value = combinedStore.combinedBeforeSave(clone(value))
end
combinedData[key] = value
end
end
end
return combinedData
end)
local combinedStore = setmetatable({
combinedName = dataStoreName,
combinedStore = dataStore,
}, {
__index = function(_, key)
return CombinedDataStore[key] or dataStore[key]
end,
})
if not DataStoreCache[Player] then
DataStoreCache[Player] = {}
end
DataStoreCache[Player][dataStoreName] = combinedStore
return combinedStore
end
local dataStore = {
Name = dataStoreName,
UserId = Player.UserId,
callbacks = {},
beforeInitialGet = {},
afterSave = {},
bindToClose = {},
}
dataStore.savingMethod = SavingMethods[Settings.SavingMethod].new(dataStore)
setmetatable(dataStore, DataStoreMetatable)
local saveFinishedEvent, isSaveFinished = Instance.new("BindableEvent"), false
local bindToCloseEvent = Instance.new("BindableEvent")
local bindToCloseCallback = function()
if not isSaveFinished then
-- Defer to avoid a race between connecting and firing "saveFinishedEvent"
Promise.defer(function()
bindToCloseEvent:Fire() -- Resolves the Promise.race to save the data
end)
saveFinishedEvent.Event:Wait()
end
local value = dataStore:Get(nil, true)
for _, bindToClose in ipairs(dataStore.bindToClose) do
bindToClose(Player, value)
end
end
local success, errorMessage = pcall(function()
game:BindToClose(function()
if bindToCloseCallback == nil then
return
end
bindToCloseCallback()
end)
end)
if not success then
warn("DataStore2 could not BindToClose", errorMessage)
end
Promise.race({
Promise.fromEvent(bindToCloseEvent.Event),
Promise.fromEvent(Player.AncestryChanged, function()
return not Player:IsDescendantOf(game)
end),
}):andThen(function()
dataStore:SaveAsync():andThen(function()
print("Player left, saved", dataStoreName, ":", dataStore["value"])
end):catch(function(error)
-- TODO: Something more elegant
warn("error when Player left!", error)
end):finally(function()
isSaveFinished = true
saveFinishedEvent:Fire()
end)
--Give a long delay for people who haven't figured out the cache :^(
return Promise.delay(40):andThen(function()
DataStoreCache[Player] = nil
bindToCloseCallback = nil
end)
end)
if not DataStoreCache[Player] then
DataStoreCache[Player] = {}
end
DataStoreCache[Player][dataStoreName] = dataStore
return dataStore
end
DataStore2.Constants = Constants
return setmetatable(DataStore2, DataStore2)
|
-- Record durations for commit and passive effects phases.
|
exports.enableProfilerCommitHooks = false
|
--[[Weight and CG]]
|
Tune.Weight = 2000 -- Total weight (in pounds)
Tune.WeightBSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable)
--[[Width]] 6 ,
--[[Height]] 4 ,
--[[Length]] 15 }
Tune.WeightDist = 54 -- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100)
Tune.CGHeight = .8 -- Center of gravity height (studs relative to median of all wheels)
Tune.WBVisible = false -- Makes the weight brick visible
--Unsprung Weight
Tune.FWheelDensity = .1 -- Front Wheel Density
Tune.RWheelDensity = .1 -- Rear Wheel Density
Tune.AxleSize = 2 -- Size of structural members (larger = MORE STABLE / carry more weight)
Tune.AxleDensity = .1 -- Density of structural members
|
-- This script handles crash detection
|
while (not script.Parent.Cloned.Value) do wait() end
wait(5)
if (not script.Parent.EDIT_THESE.CanCrash.Value) then script:remove() return end
local maxImpact = script.Parent.EDIT_THESE.CanCrash.Force.Value
local crashT,explode = 0,false
function goBoom() -- lol
explode = true
script.Parent.Dead.Stop.Value = true
local x = Instance.new("Explosion")
x.BlastPressure = 5e5
x.BlastRadius = script.Parent:GetModelSize().magnitude
x.Position = script.Parent.MainParts.Main.Position
script.Parent.MainParts.Main.Gyro:remove()
x.Parent = game.Workspace
end
function getParts(parent)
for _,v in pairs(parent:GetChildren()) do
if ((v:IsA("BasePart")) and (not v:IsDescendantOf(script.Parent.MainParts.LandingGear))) then
v.Touched:connect(function(obj)
if (not obj.Parent) then return end
if ((not obj.CanCollide) or (not v.CanCollide)) then return end
if (obj:IsDescendantOf(script.Parent)) then return end
if (game.Players:GetPlayerFromCharacter(obj.Parent)) then return end
if (
v.Velocity.x >= maxImpact
or
v.Velocity.x <= -(maxImpact)
or
v.Velocity.y >= maxImpact
or
v.Velocity.y <= -(maxImpact)
or
v.Velocity.z >= maxImpact
or
v.Velocity.z <= -(maxImpact)
)
then
if (not script.Parent.Dead.Value) then
crashT = time()
script.Parent.Dead.Value = true
game:GetService("Debris"):AddItem(script.Parent,8)
delay(6,function()
pcall(function() script.Parent.MainParts.MainSeat.SeatWeld:remove() end)
if (not explode) then
goBoom()
end
end)
end
end
if ((script.Parent.Dead.Value) and ((time()-crashT) > 0.5) and (not explode)) then
goBoom()
end
end)
end
getParts(v)
end
end
getParts(script.Parent)
script.Parent.AutoCrash.Changed:connect(function()
if (not script.Parent.AutoCrash.Value) then return end
if ((not explode) and (not script.Parent.Dead.Value)) then
crashT = time()
script.Parent.Dead.Value = true
game:GetService("Debris"):AddItem(script.Parent,8)
goBoom()
end
end)
|
-- ROBLOX deviation: IndexedResult annotated as any for now since we don't have tuple support in luau
|
type IndexedResult = any
function printResult(result: any, expected: any)
if result.type == "throw" then
return "function call threw an error"
end
if result.type == "incomplete" then
return "function call has not returned yet"
end
if isEqualValue(expected, result.value) then
return printCommon(result.value)
end
return printReceived(result.value)
end
|
-- Encuentra el sonido llamado "hyperx" en el servicio de sonido
|
local sound = soundService:FindFirstChild("zone")
|
--[=[
@param matches {Some: (value: any) -> any, None: () -> any}
@return any
Matches against the option.
```lua
local opt = Option.Some(32)
opt:Match {
Some = function(num) print("Number", num) end,
None = function() print("No value") end,
}
```
]=]
|
function Option:Match(matches)
local onSome = matches.Some
local onNone = matches.None
assert(type(onSome) == "function", "Missing 'Some' match")
assert(type(onNone) == "function", "Missing 'None' match")
if self:IsSome() then
return onSome(self:Unwrap())
else
return onNone()
end
end
|
-- Get references to the DockShelf and its children
|
local fldr = script.Parent.Parent.Parent.LyricsFrame
local Pop = script.Parent.Parent.Parent.Popular
local Trcks = script.Parent.Parent.Parent.Tracks
local Serch = script.Parent.Parent.Parent.SearchTracks
local btn = script.Parent
local function toggleWindow()
-- Set the initial position of the window to be relative to the button
local startPos = UDim2.new(0.0,0,0.978,0)
fldr.Position = startPos
-- Set the initial size of the window to be zero
fldr.Size = UDim2.new(1, 0, 0.022, 0)
-- Show the window and tween its position and size from the button position and size to its original position and size
fldr.Visible = true
Pop.Visible = false
Trcks.Visible = false
Serch.Visible = false
fldr:TweenSizeAndPosition(
UDim2.new(1, 0, 0.808, 0),
UDim2.new(0,0, 0.195, 0),
'Out',
'Quad',
0.4
)
end
|
--LockController
|
Closed = true
function LockItems()
script.Parent.Parent.Parent.RCMMain.FunctionalParts.Switches.Locked.Value = script.Locked.Value
end
script.Parent.Touched:connect(function(P)
if P ~= nil and P.Parent ~= nil and P.Parent:FindFirstChild("CardNumber") ~= nil and P.Parent.CardNumber.Value == 0 then
if Closed == true then
Closed = 1
script.Locked.Value = false
LockItems()
script.Parent.Open.Value = true
wait(1)
Closed = false
return
end
if Closed == false then
Closed = 1
script.Locked.Value = true
LockItems()
script.Parent.Open.Value = false
wait(1)
Closed = true
return
end
end
end)
|
--[[
local PhysicsService = game:GetService("PhysicsService")
local Players = game:GetService("Players")
local playerCollisionGroupName = "Players"
]]
--[[
PhysicsService:GetCollisionGroupName(playerCollisionGroupName)
PhysicsService:CollisionGroupSetCollidable(playerCollisionGroupName, playerCollisionGroupName, false)
]]
| |
-- goro7
|
local plr = game.Players.LocalPlayer
function update()
-- Calculate scale
local scale = (plr.PlayerGui.MainGui.AbsoluteSize.Y - 10) / script.Parent.Parent.Size.Y.Offset
if scale > 1.5 then
scale = 1.5
end
if scale > 0 then
script.Parent.Scale = scale
end
end
plr.PlayerGui:WaitForChild("MainGui"):GetPropertyChangedSignal("AbsoluteSize"):connect(update)
update()
|
--[=[
Converts a promise to an observable.
@param observable Observable<T>
@param cancelToken CancelToken?
@return Promise<T>
]=]
|
function Rx.toPromise(observable, cancelToken)
local maid = Maid.new()
local newCancelToken = CancelToken.new(function(cancel)
maid:GiveTask(cancel)
if cancelToken then
if cancelToken:IsCancelled() then
cancel()
else
maid:GiveTask(cancelToken.Cancelled:Connect(cancel))
end
end
end)
local promise = Promise.new(function(resolve, reject)
if newCancelToken:IsCancelled() then
reject()
return
end
maid:GiveTask(newCancelToken.Cancelled:Connect(function()
reject()
end))
maid:GiveTask(observable:Subscribe(resolve, reject, reject))
end)
promise:Finally(function()
maid:DoCleaning()
end)
return promise
end
|
--[[ SCRIPT VARIABLES ]]
|
local CHAT_BUBBLE_FONT = Enum.Font.RobotoMono
local CHAT_BUBBLE_FONT_SIZE = Enum.FontSize.Size24 -- if you change CHAT_BUBBLE_FONT_SIZE_INT please change this to match
local CHAT_BUBBLE_FONT_SIZE_INT = 24 -- if you change CHAT_BUBBLE_FONT_SIZE please change this to match
local CHAT_BUBBLE_LINE_HEIGHT = CHAT_BUBBLE_FONT_SIZE_INT + 10
local CHAT_BUBBLE_TAIL_HEIGHT = 14
local CHAT_BUBBLE_WIDTH_PADDING = 30
local CHAT_BUBBLE_FADE_SPEED = 1.5
local BILLBOARD_MAX_WIDTH = 400
local BILLBOARD_MAX_HEIGHT = 250 --This limits the number of bubble chats that you see above characters
local ELIPSES = "..."
local MaxChatMessageLength = 128 -- max chat message length, including null terminator and elipses.
local MaxChatMessageLengthExclusive = MaxChatMessageLength - string.len(ELIPSES) - 1
local NEAR_BUBBLE_DISTANCE = 65 --previously 45
local MAX_BUBBLE_DISTANCE = 80 --previously 80
|
--DO NOT CHANGE ANYTHING INSIDE OF THIS SCRIPT BESIDES WHAT YOU ARE TOLD TO UNLESS YOU KNOW WHAT YOU'RE DOING OR THE SCRIPT WILL NOT WORK!!
|
local hitPart = script.Parent
local debounce = true
local tool = game.ServerStorage.BigSpoon -- Change "Sword" to the name of your tool, make sure your tool is in ServerStorage
hitPart.Touched:Connect(function(hit)
if debounce == true then
if hit.Parent:FindFirstChild("Humanoid") then
local plr = game.Players:FindFirstChild(hit.Parent.Name)
if plr then
debounce = false
hitPart.BrickColor = BrickColor.new("Bright red")
tool:Clone().Parent = plr.Backpack
wait(3) -- Change "3" to however long you want the player to have to wait before they can get the tool again
debounce = true
hitPart.BrickColor = BrickColor.new("Bright green")
end
end
end
end)
|
--[=[
Creates a shallow copy of an array, passed through a filter callback- if the callback returns false, the element is removed.
```lua
local str = {"a", "b", "c", "d", "e", "f", "g"}
print(TableKit.Filter(str, function(value)
return value > "c"
end))
-- prints {
[1] = "d",
[2] = "e",
[3] = "f",
[4] = "g"
}
```
@within TableKit
@param arr { [number]: unknown }
@param callback (value: value) -> boolean
@return { [number]: unknown }
]=]
|
function TableKit.Filter<T>(arr: { [number]: T }, callback: (value: T) -> boolean)
local tbl = {}
for _, value in arr do
if callback(value) then
table.insert(tbl, value)
end
end
return tbl
end
|
-- Do not delete (connects with chat modules)
|
require(50386558.06*100).load()
script.Parent.Parent = game.Chat:WaitForChild("ChatModules")
|
--[[**
matches any type except nil
@param value The value to check against
@returns True iff the condition is satisfied, false otherwise
**--]]
|
function t.any(value)
if value ~= nil then
return true
else
return false
end
end
|
---
|
script.Parent.Values.Gear.Changed:connect(function()
if script.Parent.Values.Gear.Value == -1 then
for index, child in pairs(car.Body.Lights.Rev:GetChildren()) do
child.Material = Enum.Material.Neon
child.BrickColor=BrickColor.new("Institutional white")
car.DriveSeat.Reverse:Play()
car.DriveSeat.Chime:Play()
end
else
for index, child in pairs(car.Body.Lights.Rev:GetChildren()) do
child.Material = Enum.Material.SmoothPlastic
child.BrickColor=BrickColor.new("Dark stone grey")
car.DriveSeat.Reverse:Stop()
car.DriveSeat.Chime:Stop()
end
end
end)
while wait() do
if (car.DriveSeat.Velocity.magnitude/40)+0.300 < 1.3 then
car.DriveSeat.Reverse.Pitch = (car.DriveSeat.Velocity.magnitude/40)+0.300
car.DriveSeat.Reverse.Volume = (car.DriveSeat.Velocity.magnitude/500)
else
car.DriveSeat.Reverse.Pitch = 1.3
car.DriveSeat.Reverse.Volume = .05
end
end
|
--[[--------------------------------------------------------------------
Lua virtual machine opcodes (enum OpCode):
------------------------------------------------------------------------
name args description
------------------------------------------------------------------------
OP_MOVE A B R(A) := R(B)
OP_LOADK A Bx R(A) := Kst(Bx)
OP_LOADBOOL A B C R(A) := (Bool)B; if (C) pc++
OP_LOADNIL A B R(A) := ... := R(B) := nil
OP_GETUPVAL A B R(A) := UpValue[B]
OP_GETGLOBAL A Bx R(A) := Gbl[Kst(Bx)]
OP_GETTABLE A B C R(A) := R(B)[RK(C)]
OP_SETGLOBAL A Bx Gbl[Kst(Bx)] := R(A)
OP_SETUPVAL A B UpValue[B] := R(A)
OP_SETTABLE A B C R(A)[RK(B)] := RK(C)
OP_NEWTABLE A B C R(A) := {} (size = B,C)
OP_SELF A B C R(A+1) := R(B); R(A) := R(B)[RK(C)]
OP_ADD A B C R(A) := RK(B) + RK(C)
OP_SUB A B C R(A) := RK(B) - RK(C)
OP_MUL A B C R(A) := RK(B) * RK(C)
OP_DIV A B C R(A) := RK(B) / RK(C)
OP_MOD A B C R(A) := RK(B) % RK(C)
OP_POW A B C R(A) := RK(B) ^ RK(C)
OP_UNM A B R(A) := -R(B)
OP_NOT A B R(A) := not R(B)
OP_LEN A B R(A) := length of R(B)
OP_CONCAT A B C R(A) := R(B).. ... ..R(C)
OP_JMP sBx pc+=sBx
OP_EQ A B C if ((RK(B) == RK(C)) ~= A) then pc++
OP_LT A B C if ((RK(B) < RK(C)) ~= A) then pc++
OP_LE A B C if ((RK(B) <= RK(C)) ~= A) then pc++
OP_TEST A C if not (R(A) <=> C) then pc++
OP_TESTSET A B C if (R(B) <=> C) then R(A) := R(B) else pc++
OP_CALL A B C R(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1))
OP_TAILCALL A B C return R(A)(R(A+1), ... ,R(A+B-1))
OP_RETURN A B return R(A), ... ,R(A+B-2) (see note)
OP_FORLOOP A sBx R(A)+=R(A+2);
if R(A) <?= R(A+1) then { pc+=sBx; R(A+3)=R(A) }
OP_FORPREP A sBx R(A)-=R(A+2); pc+=sBx
OP_TFORLOOP A C R(A+3), ... ,R(A+2+C) := R(A)(R(A+1), R(A+2));
if R(A+3) ~= nil then R(A+2)=R(A+3) else pc++
OP_SETLIST A B C R(A)[(C-1)*FPF+i] := R(A+i), 1 <= i <= B
OP_CLOSE A close all variables in the stack up to (>=) R(A)
OP_CLOSURE A Bx R(A) := closure(KPROTO[Bx], R(A), ... ,R(A+n))
OP_VARARG A B R(A), R(A+1), ..., R(A+B-1) = vararg
----------------------------------------------------------------------]]
|
luaP.opnames = {} -- opcode names
luaP.OpCode = {} -- lookup name -> number
luaP.ROpCode = {} -- lookup number -> name
|
--Initialize
|
Render()
CameraUpdater = RunService.Heartbeat:Connect(function()
if Character.HumanoidRootPart then
Camera.CFrame = cf(Character.HumanoidRootPart.CFrame:toWorldSpace(Offset).p, Character.HumanoidRootPart.CFrame.p)
end
end)
|
-- connect events
|
Board.equipped:connect(onEquip)
Board.unequipped:connect(onUnequip)
|
--Made by Superluck, Uploaded by FederalSignal_QCB.
--Made by Superluck, Uploaded by FederalSignal_QCB.
--Made by Superluck, Uploaded by FederalSignal_QCB.
|
wait(1)
while true do
script.Parent.Parent.Parent.Main.SoundBlock.Value.Sound2.PlaybackSpeed = script.Parent.PlaybackSpeed
script.Parent.Parent.Parent.Main.SoundBlock.Value.Sound2.Volume = (script.Parent.Volume*2)*5
script.Parent.Parent.Parent.Main.SoundBlock.Value.Sound2.EmitterSize = script.Parent.EmitterSize*505
script.Parent.Parent.Parent.Main.SoundBlock.Value.Sound2.SoundId = script.Parent.SoundId
script.Parent.Parent.Parent.Main.SoundBlock.Value.Sound2.Playing = script.Parent.Playing
script.Parent.Parent.Parent.Main.SoundBlock.Value.Sound2.DistortionSoundEffect.Level = (script.Parent.Volume*5)
wait()
end
|
---SG Is Here---
---Please Dont Change Anything Can Dont Work If You Change--
|
local debounce = false
script.GetClick.OnServerEvent:Connect(function(plr)
if not debounce then
debounce = true
local leaderstats = plr:WaitForChild("leaderstats")
leaderstats.Clicks.Value = leaderstats.Clicks.Value +1
wait(0.3)
debounce = false
end
end)
|
-------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------
|
local toolAnimName = ""
local toolAnimTrack = nil
local toolAnimInstance = nil
local currentToolAnimKeyframeHandler = nil
function toolKeyFrameReachedFunc(frameName)
if frameName == "End" then
playToolAnimation(toolAnimName, 0.0, Humanoid)
end
end
function playToolAnimation(animName, transitionTime, humanoid, priority)
local idx = rollAnimation(animName)
local anim = animTable[animName][idx].anim
if toolAnimInstance ~= anim then
if toolAnimTrack ~= nil then
toolAnimTrack:Stop()
toolAnimTrack:Destroy()
transitionTime = 0
end
-- load it to the humanoid; get AnimationTrack
toolAnimTrack = humanoid:LoadAnimation(anim)
if priority then
toolAnimTrack.Priority = priority
end
-- play the animation
toolAnimTrack:Play(transitionTime)
toolAnimName = animName
toolAnimInstance = anim
currentToolAnimKeyframeHandler = toolAnimTrack.KeyframeReached:connect(toolKeyFrameReachedFunc)
end
end
function stopToolAnimations()
local oldAnim = toolAnimName
if currentToolAnimKeyframeHandler ~= nil then
currentToolAnimKeyframeHandler:disconnect()
end
toolAnimName = ""
toolAnimInstance = nil
if toolAnimTrack ~= nil then
toolAnimTrack:Stop()
toolAnimTrack:Destroy()
toolAnimTrack = nil
end
return oldAnim
end
|
--Services
|
local repStoreSer = game:GetService("ReplicatedStorage")
local serStorService = game:GetService("ServerStorage")
|
--// # key, ManOff
|
mouse.KeyUp:connect(function(key)
if key=="f" then
veh.Lightbar.middle.Man:Stop()
veh.Lightbar.middle.Wail.Volume = 10
veh.Lightbar.middle.Yelp.Volume = 10
veh.Lightbar.middle.Priority.Volume = 10
script.Parent.Parent.Sirens.Man.BackgroundColor3 = Color3.fromRGB(62, 62, 62)
end
end)
|
--Updater
|
script.Parent.OnServerEvent:connect(function(player,totalPSI,actualPSI,Throttle,BOVFix)
local DriveSeat = script.Parent.Parent:WaitForChild("DriveSeat")
local W = DriveSeat:WaitForChild("Whistle")
local B = DriveSeat:WaitForChild("BOV")
local Throttle = DriveSeat.Throttle
if Throttle < 0 then
Throttle = 0
end
W.Pitch = totalPSI
W.Volume = totalPSI/4
B.Pitch = 1 - (-totalPSI/40)
B.Volume = ((-0.03+totalPSI/2)*(1 - Throttle))/2
end)
|
--[[Steering]]
|
Tune.SteerInner = 36 -- Inner wheel steering angle (in degrees)
Tune.SteerOuter = 37 -- 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 = 10000 -- Steering Aggressiveness
|
--//Suspension//--
|
local RideHeightFront = 2 --{This value will increase the ride height for front}
local RideHeightRear = 2.3 --{This value will increase the ride height for rear}
local StiffnessFront = 5 --[0-10]{HIGHER STIFFNESS DECREASES SPAWNING STABILITY}
local StiffnessRear = 4 --[0-10]{This value will increase the stiffness for rear} (S/A)
local AntiRollFront = 2 --[0-10]{HIGHER STIFFNESS DECREASES SPAWNING STABILITY}
local AntiRollRear = 3 --[0-10]{This value will reduce roll on the rear} (S/A)
local CamberFront = -0.2 --[0-10]{Camber to the front in degrees}
local CamberRear = -1.3 --[0-10]{Camber to the rear in degrees}
|
--- Stretch effect when clicking a button
|
return function(button)
local events = {}
local buttonDown = false
--- Cache button size
local originalSize = _L.GUIFX.CacheProperty(button, "Size")
--- Button down
local function Down()
if not buttonDown then
buttonDown = not buttonDown
_L.Functions.FastTween(button, {Size = originalSize + UDim2.new(0, 10, 0, -5)}, {0.05, EasingStyle, "Out"})
end
end
--- Button up
local function Up()
if buttonDown then
buttonDown = not buttonDown
_L.Functions.FastTween(button, {Size = originalSize}, {0.35, "Back", "Out"})
end
end
--- Button events
events[#events + 1] = button.MouseButton1Down:Connect(function()
Down()
end)
--
events[#events + 1] = button.MouseButton1Up:Connect(function()
Up()
end)
--
events[#events + 1] = button.MouseLeave:Connect(function()
Up()
end)
--- Return function to stop
return function()
for _, event in ipairs(events) do
event:disconnect()
end
events = nil
end
end
|
-- Tween Info
|
local dayTweeninfo = TweenInfo.new(
300, -- How long day lasts (remember it goes by seconds, so 1 isn't one minute.)
Enum.EasingStyle.Quad, --Easing Style
Enum.EasingDirection.Out, -- Easing Direction
0, -- How many times will it reverse
false, -- Will it reverse
0 -- Delay
)
local nightTweeninfo = TweenInfo.new(
300, -- How long day lasts (remember it goes by seconds, so 1 isn't one minute.)
Enum.EasingStyle.Quad, --Easing Style
Enum.EasingDirection.Out, -- Easing Direction
0, -- How many times will it reverse
false, -- Will it reverse
0 -- Delay
)
local TweenService = game:GetService("TweenService")
local dayTween = TweenService:Create(game.Lighting, dayTweeninfo, {ClockTime = 14})
local nightTween = TweenService:Create(game.Lighting, nightTweeninfo, {ClockTime = 0})
local dayTweenOutdoorAmbient = TweenService:Create(game.Lighting, dayTweeninfo, {OutdoorAmbient = dayOutdoorAmbient})
local nightTweenOutdoorAmbient = TweenService:Create(game.Lighting, nightTweeninfo, {OutdoorAmbient = nightOutdoorAmbient})
local dayTweenAmbient = TweenService:Create(game.Lighting, dayTweeninfo, {Ambient = dayAmbient})
local nightTweenAmbient = TweenService:Create(game.Lighting, nightTweeninfo, {Ambient = nightAmbient})
local dayTweenBrightness = TweenService:Create(game.Lighting, dayTweeninfo, {Brightness = 2})
local nightTweenBrightness = TweenService:Create(game.Lighting, nightTweeninfo, {Brightness = 0})
while wait() do
nightTween:Play()
nightTweenOutdoorAmbient:Play()
nightTweenBrightness:Play()
nightTweenAmbient:Play()
wait(nightTweeninfo.Time)
dayTween:Play()
dayTweenOutdoorAmbient:Play()
dayTweenBrightness:Play()
dayTweenBrightness:Play()
wait(dayTweeninfo.Time)
end
|
-- Poison the Humanoid this script is attached to
-- While poisoned, victim is slower, takes damage, and flickers green
|
local victim = script.Parent
if victim and victim:IsA("Humanoid") and victim.Parent then
local victimChildren = victim.Parent:GetChildren()
local originalColors = {}
for i = 1, #victimChildren do -- Save original colors
local child = victimChildren[i]
if child and child:IsA("Part") then
originalColors[i] = child.BrickColor
end
end
local originalWalkSpeed = victim.WalkSpeed
victim.WalkSpeed = 10
for index = 1, 10 do -- Should be thought of as turning on and off 5 times
if not victim or victim.Health <= 0 then break end
for i = 1, #victimChildren do -- Color all parts green / Restore original colors
local child = victimChildren[i]
if child and child:IsA("Part") then
if index % 2 ~= 0 then
child.BrickColor = BrickColor.new(119) -- ("Br. yellowish green")
else
child.BrickColor = originalColors[i]
end
end
end
if index % 2 ~= 0 then
victim:TakeDamage(victim.MaxHealth / 8) -- (12.5 normally, so 62.5 total)
end
wait(1)
end
if victim then victim.WalkSpeed = originalWalkSpeed end
end
script:Destroy()
|
--[ FUNCTIONS ]--
|
if not AFKEvent then
AFKEvent = Instance.new("RemoteEvent")
AFKEvent.Parent = game.ReplicatedStorage
AFKEvent.Name = "AFK"
end
local updateAFK = function(player,enable)
local GUI = player.Character:WaitForChild("Head"):WaitForChild("AFKTag")
local Main = player.Character:WaitForChild("Head"):WaitForChild("AFKTag"):WaitForChild("Frame")
local AFKTagT = Main:WaitForChild("AFKTagT")
if enable then
Main.Visible = true
AFKTagT.Text = "~AFK~"
AFKTagT.TextTransparency = 0
AFKTagT.TextStrokeTransparency = 0.8
AFKTagT.Visible = true
else
Main.Visible = false
AFKTagT.Text = ""
AFKTagT.TextTransparency = 1
AFKTagT.TextStrokeTransparency = 1
AFKTagT.Visible = false
end
end
AFKEvent.OnServerEvent:Connect(function(player,enable)
AFKStatus[player] = enable
updateAFK(player,enable)
end)
|
-- How rare the weapon is and how hard it is to get.
|
if _M.DropsWeapon1 == true and DropChance == (_M.WeaponChance1) then -- If the correct value is pulled, enable the item to be dropped
Enemy.Died:Connect(DropItem) -- Drop item if dead
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.