prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
-- Update camera if it changes
|
workspace.Changed:connect(function (p)
if p == "CurrentCamera" then
camera = workspace.CurrentCamera
end
end)
coroutine.resume(coroutine.create(function()
game:GetService("RunService").Stepped:connect(function()
Indicator:updateAll()
game:GetService("RunService").RenderStepped:wait()
end)
end))
|
--[[[Default Controls]]
|
--Peripheral Deadzones
Tune.Peripherals = {
MSteerWidth = 67 , -- Mouse steering control width (0 - 100% of screen width)
MSteerDZone = 10 , -- Mouse steering deadzone (0 - 100%)
ControlLDZone = 5 , -- Controller steering L-deadzone (0 - 100%)
ControlRDZone = 5 , -- Controller steering R-deadzone (0 - 100%)
}
--Control Mapping
Tune.Controls = {
--Keyboard Controls
--Mode Toggles
ToggleTransMode = Enum.KeyCode.M ,
--Primary Controls
Throttle = Enum.KeyCode.Up ,
Brake = Enum.KeyCode.Down ,
SteerLeft = Enum.KeyCode.Left ,
SteerRight = Enum.KeyCode.Right ,
ToggleTCS = Enum.KeyCode.T ,
ToggleABS = Enum.KeyCode.B ,
--Secondary Controls
Throttle2 = Enum.KeyCode.W ,
Brake2 = Enum.KeyCode.S ,
SteerLeft2 = Enum.KeyCode.A ,
SteerRight2 = Enum.KeyCode.D ,
--Manual Transmission
ShiftUp = Enum.KeyCode.E ,
ShiftDown = Enum.KeyCode.Q ,
Clutch = Enum.KeyCode.LeftShift ,
--Handbrake
PBrake = Enum.KeyCode.P ,
--Mouse Controls
MouseThrottle = Enum.UserInputType.MouseButton1 ,
MouseBrake = Enum.UserInputType.MouseButton2 ,
MouseClutch = Enum.KeyCode.W ,
MouseShiftUp = Enum.KeyCode.E ,
MouseShiftDown = Enum.KeyCode.Q ,
MousePBrake = Enum.KeyCode.LeftShift ,
--Controller Mapping
ContlrThrottle = Enum.KeyCode.ButtonR2 ,
ContlrBrake = Enum.KeyCode.ButtonL2 ,
ContlrSteer = Enum.KeyCode.Thumbstick1 ,
ContlrShiftUp = Enum.KeyCode.ButtonY ,
ContlrShiftDown = Enum.KeyCode.ButtonX ,
ContlrClutch = Enum.KeyCode.ButtonR1 ,
ContlrPBrake = Enum.KeyCode.ButtonL1 ,
ContlrToggleTMode = Enum.KeyCode.DPadUp ,
ContlrToggleTCS = Enum.KeyCode.DPadDown ,
ContlrToggleABS = Enum.KeyCode.DPadRight ,
}
|
-- / Settings / --
|
local Settings = {
OnCD = false
}
|
---////==========================================\\\---
--Controller for: Korean Arrow Display
|
SignalLeft = script.InvertDirection.Value and script.Parent.Parent.Parent.ControlBox.IsOnRight or script.Parent.Parent.Parent.ControlBox.IsOnLeft
SignalRight = script.InvertDirection.Value and script.Parent.Parent.Parent.ControlBox.IsOnLeft or script.Parent.Parent.Parent.ControlBox.IsOnRight
|
-- FIXME: Capture this as a local variable before returning, else a luau bug
-- prevents __call from being understood: https://jira.rbx.com/browse/CLI-40294
|
local interface = setmetatable(RegExp, {
__call = new,
})
return interface
|
---////==========================================\\\---
--Controller for: 2-Way Railroad Crossing Lights
|
Signal = script.Parent.Parent.Parent.ControlBox.CrossingValues.CrossingSignals
|
--//Variables--
|
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
|
-- Initialization
|
for _, child in ipairs(Storage:GetChildren()) do
table.insert(Buffer, child)
end
|
-- ================================================================================
-- VARIABLES
-- ================================================================================
-- Services
|
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local GuiService = game:GetService("GuiService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local IS_CONSOLE = GuiService:IsTenFootInterface()
local IS_MOBILE = UserInputService.TouchEnabled and not UserInputService.MouseEnabled and not IS_CONSOLE
local GAMEPAD_DEADZONE = 0.1
|
--[[Transmission]]
|
Tune.TransModes = {"Auto"} --[[
[Modes]
"Auto" : Automatic shifting
"Semi" : Clutchless manual shifting, dual clutch transmission
"Manual" : Manual shifting with clutch
>Include within brackets
eg: {"Semi"} or {"Auto", "Manual"}
>First mode is default mode ]]
--Automatic Settings
Tune.AutoShiftMode = "RPM" --[[
[Modes]
"Speed" : Shifts based on wheel speed
"RPM" : Shifts based on RPM ]]
Tune.AutoUpThresh = -200 --Automatic upshift point (relative to peak RPM, positive = Over-rev)
Tune.AutoDownThresh = 1400 --Automatic downshift point (relative to peak RPM, positive = Under-rev)
--Gear Ratios
Tune.FinalDrive = 4.60 -- [TRANSMISSION CALCULATIONS FOR NERDS]
Tune.Ratios = { -- SPEED [SPS] = (Wheel diameter(studs) * pi(3.14) * RPM) / (60 * Gear Ratio * Final Drive * Multiplier)
--[[Reverse]] 3.484 ,-- WHEEL TORQUE = Engine Torque * Gear Ratio * Final Drive * Multiplier
--[[Neutral]] 0 ,
--[[ 1 ]] 3.587 ,
--[[ 2 ]] 2.022 ,
--[[ 3 ]] 1.384 ,
--[[ 4 ]] 1.000 ,
--[[ 5 ]] 0.861 ,
--[[ 6 ]] 0.621 ,
}
Tune.FDMult = 1.7 -- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
|
-- Configuration
|
local maxCharacters = 500
local defaultText = "Type your feedback here"
|
--[=[
Convert percentVisible observable to transparency
@function toTransparency
@param source Observable<number>
@return Observable<number>
@within BasicPaneUtils
]=]
|
BasicPaneUtils.toTransparency = Rx.map(function(value)
return 1 - value
end)
|
--[[Transmission]]
|
Tune.TransModes = {"Auto","Semi"} --[[
[Modes]
"Auto" : Automatic shifting
"Semi" : Clutchless manual shifting, dual clutch transmission
"Manual" : Manual shifting with clutch
>Include within brackets
eg: {"Semi"} or {"Auto", "Manual"}
>First mode is default mode ]]
--Automatic Settings
Tune.AutoShiftMode = "Speed" --[[
[Modes]
"Speed" : Shifts based on wheel speed
"RPM" : Shifts based on RPM ]]
Tune.AutoUpThresh = -3200 -- Automatic upshift point (relative to peak RPM, positive = Over-rev)
Tune.AutoDownThresh = 2400 -- Automatic downshift point (relative to peak RPM, positive = Under-rev)
Tune.ShiftTime = .05 -- The time delay in which you initiate a shift and the car changes gear
--Gear Ratios
Tune.FinalDrive = 2.9
Tune.Ratios = {
--[[Reverse]] 4.29 ,
--[[Neutral]] 0 ,
--[[ 1 ]] 4.71 ,
--[[ 2 ]] 3.14 ,
--[[ 3 ]] 2.10 ,
--[[ 4 ]] 1.67 ,
--[[ 5 ]] 1.29 ,
--[[ 6 ]] 1.00 ,
--[[ 7 ]] 0.84 ,
}
Tune.FDMult = 1.00 -- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
|
--Automatic Gauge Scaling
|
if autoscaling then
local Drive={}
if _Tune.Config == "FWD" or _Tune.Config == "AWD" then
if car.Wheels:FindFirstChild("FL")~= nil then
table.insert(Drive,car.Wheels.FL)
end
if car.Wheels:FindFirstChild("FR")~= nil then
table.insert(Drive,car.Wheels.FR)
end
if car.Wheels:FindFirstChild("F")~= nil then
table.insert(Drive,car.Wheels.F)
end
end
if _Tune.Config == "RWD" or _Tune.Config == "AWD" then
if car.Wheels:FindFirstChild("RL")~= nil then
table.insert(Drive,car.Wheels.RL)
end
if car.Wheels:FindFirstChild("RR")~= nil then
table.insert(Drive,car.Wheels.RR)
end
if car.Wheels:FindFirstChild("R")~= nil then
table.insert(Drive,car.Wheels.R)
end
end
local wDia = 0
for i,v in pairs(Drive) do
if v.Size.x>wDia then wDia = v.Size.x end
end
Drive = nil
for i,v in pairs(UNITS) do
v.maxSpeed = math.ceil(v.scaling*wDia*math.pi*_lRPM/60/_Tune.Ratios[#_Tune.Ratios]/_Tune.FinalDrive)
v.spInc = math.max(math.ceil(v.maxSpeed/200)*20,20)
end
end
for i=0,revEnd*2 do
local ln = script.Parent.ln:clone()
ln.Parent = script.Parent.Tach
ln.Rotation = 45 + i * 225 / (revEnd*2)
ln.Num.Text = i/2
ln.Num.Rotation = -ln.Rotation
if i*500>=math.floor(_pRPM/500)*500 then
ln.Frame.BackgroundColor3 = Color3.new(1,0,0)
if i<revEnd*2 then
ln2 = ln:clone()
ln2.Parent = script.Parent.Tach
ln2.Rotation = 45 + (i+.5) * 225 / (revEnd*2)
ln2.Num:Destroy()
ln2.Visible=true
end
end
if i%2==0 then
ln.Frame.Size = UDim2.new(0,3,0,10)
ln.Frame.Position = UDim2.new(0,-1,0,100)
ln.Num.Visible = true
else
ln.Num:Destroy()
end
ln.Visible=true
end
local lns = Instance.new("Frame",script.Parent.Speedo)
lns.Name = "lns"
lns.BackgroundTransparency = 1
lns.BorderSizePixel = 0
lns.Size = UDim2.new(0,0,0,0)
for i=1,90 do
local ln = script.Parent.ln:clone()
ln.Parent = lns
ln.Rotation = 45 + 225*(i/90)
if i%2==0 then
ln.Frame.Size = UDim2.new(0,2,0,10)
ln.Frame.Position = UDim2.new(0,-1,0,100)
else
ln.Frame.Size = UDim2.new(0,3,0,5)
end
ln.Num:Destroy()
ln.Visible=true
end
for i,v in pairs(UNITS) do
local lnn = Instance.new("Frame",script.Parent.Speedo)
lnn.BackgroundTransparency = 1
lnn.BorderSizePixel = 0
lnn.Size = UDim2.new(0,0,0,0)
lnn.Name = v.units
if i~= 1 then lnn.Visible=false end
for i=0,v.maxSpeed,v.spInc do
local ln = script.Parent.ln:clone()
ln.Parent = lnn
ln.Rotation = 45 + 225*(i/v.maxSpeed)
ln.Num.Text = i
ln.Num.TextSize = 14
ln.Num.Rotation = -ln.Rotation
ln.Frame:Destroy()
ln.Num.Visible=true
ln.Visible=true
end
end
if script.Parent.Parent.IsOn.Value then
script.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
script.Parent.Parent.IsOn.Changed:connect(function()
if script.Parent.Parent.IsOn.Value then
script.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
end)
script.Parent.Parent.Values.RPM.Changed:connect(function()
script.Parent.Tach.Needle.Rotation = 45 + 225 * math.min(1,script.Parent.Parent.Values.RPM.Value / (revEnd*1000))
end)
script.Parent.Parent.Values.Gear.Changed:connect(function()
local gearText = script.Parent.Parent.Values.Gear.Value
if gearText == 0 then gearText = "N"
elseif gearText == -1 then gearText = "R"
end
script.Parent.Gear.Text = gearText
end)
script.Parent.Parent.Values.TCS.Changed:connect(function()
if _Tune.TCSEnabled then
if script.Parent.Parent.Values.TCS.Value then
script.Parent.TCS.TextColor3 = Color3.new(1,170/255,0)
script.Parent.TCS.TextStrokeColor3 = Color3.new(1,170/255,0)
if script.Parent.Parent.Values.TCSActive.Value then
wait()
script.Parent.TCS.Visible = not script.Parent.TCS.Visible
else
wait()
script.Parent.TCS.Visible = false
end
else
script.Parent.TCS.Visible = true
script.Parent.TCS.TextColor3 = Color3.new(1,0,0)
script.Parent.TCS.TextStrokeColor3 = Color3.new(1,0,0)
end
else
script.Parent.TCS.Visible = false
end
end)
script.Parent.Parent.Values.TCSActive.Changed:connect(function()
if _Tune.TCSEnabled then
if script.Parent.Parent.Values.TCSActive.Value and script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = not script.Parent.TCS.Visible
elseif not script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = true
else
wait()
script.Parent.TCS.Visible = false
end
else
script.Parent.TCS.Visible = false
end
end)
script.Parent.TCS.Changed:connect(function()
if _Tune.TCSEnabled then
if script.Parent.Parent.Values.TCSActive.Value and script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = not script.Parent.TCS.Visible
elseif not script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = true
end
else
if script.Parent.TCS.Visible then
script.Parent.TCS.Visible = false
end
end
end)
|
-- NOTE: there is some value-specific code that involves VARARG_NEEDSARG
|
luaY.VARARG_NEEDSARG = 4
luaY.LUA_MULTRET = -1 -- (lua.h)
|
-- if GetHitPlayers() >= 3 then
-- AwardBadge:Invoke(FiredPlayer,"Explosive Results")
-- end
|
local FiredPlayer = ReflectedPlayer or FiredPlayer
local DoDamage = PlayerDamager:CanDamageHumanoid(FiredPlayer,HitHumanoid)
if DoDamage then
local DamageFraction = 0
if RadiusFromBlast < BLAST_RADIUS/2 then
DamageFraction = 1
elseif RadiusFromBlast < BLAST_RADIUS then
DamageFraction = 1 - (RadiusFromBlast - BLAST_RADIUS/2)/(BLAST_RADIUS/2)
end
if HitPlayer == FiredPlayer and DamageFraction == 1 then
HitHumanoid.Health = 0
else
PlayerDamager:DamageHumanoid(FiredPlayer,HitHumanoid,50 + (DamageFraction * 50),DamageName)
end
end
end
end
--Break joints if it isn't a character.
if BreakJoints then
ExplosionTouchPart:BreakJoints()
end
--If the part is able to fade with explosions, signal it to fade.
|
--[[
This is a simple signal implementation that has a dead-simple API.
local signal = createSignal()
local disconnect = signal:subscribe(function(foo)
print("Cool foo:", foo)
end)
signal:fire("something")
disconnect()
]]
|
local function addToMap(map, addKey, addValue)
local new = {}
for key, value in pairs(map) do
new[key] = value
end
new[addKey] = addValue
return new
end
local function removeFromMap(map, removeKey)
local new = {}
for key, value in pairs(map) do
if key ~= removeKey then
new[key] = value
end
end
return new
end
local function createSignal()
local connections = {}
local function subscribe(_, callback)
assert(typeof(callback) == "function", "Can only subscribe to signals with a function.")
local connection = {
callback = callback,
}
connections = addToMap(connections, callback, connection)
local function disconnect()
assert(not connection.disconnected, "Listeners can only be disconnected once.")
connection.disconnected = true
connections = removeFromMap(connections, callback)
end
return disconnect
end
local function fire(_, ...)
for callback, connection in pairs(connections) do
if not connection.disconnected then
callback(...)
end
end
end
return {
subscribe = subscribe,
fire = fire,
}
end
return createSignal
|
-- MODULES --
|
local ragdollBuilder = require(script.RagdollBuilder)
|
-- Update the effect on every single frame.
|
RunService.RenderStepped:Connect(updateBobbleEffect)
|
--brownUI = Color3.fromRGB(230, 191, 157),
|
essenceYellow = Color3.fromRGB(255, 255, 111),
badRed = Color3.fromRGB(255, 0, 0),
fadedBadRed = Color3.fromRGB(129, 0, 0),
uncooked = Color3.fromRGB(195, 116, 116),
goodGreen = Color3.fromRGB(170, 255, 0),
fadedGoodGreen = Color3.fromRGB(106, 129, 58),
grey200 = Color3.fromRGB(200,200,200),
ironGrey = Color3.fromRGB(200, 190, 181),
steel = Color3.fromRGB(106, 97, 84),
mojoPurp = Color3.fromRGB(222, 147, 223)
}
return module
|
-- It's important we update all icons when a players language changes to account for changes in the width of text, etc
|
task.spawn(function()
local LocalizationService = game:GetService("LocalizationService")
local success, translator = pcall(function() return LocalizationService:GetTranslatorForPlayerAsync(localPlayer) end)
local function updateAllIcons()
local icons = IconController.getIcons()
for _, icon in pairs(icons) do
icon:_updateAll()
end
end
if success then
translator:GetPropertyChangedSignal("LocaleId"):Connect(updateAllIcons)
task.delay(1, updateAllIcons)
task.delay(10, updateAllIcons)
end
end)
return IconController
|
--Check moderation data
|
game.Players.PlayerAdded:Connect(function(plr)
--Kick new players if game is shutting down
if shuttingDown then
plr:Kick("This server has shut down.")
end
--Kick banned players, or remove ban data if ban time is over
local banSuccess, banData = pcall(function()
local data = ds:GetAsync(plr.UserId .. "Banned")
return data
end)
if banSuccess and banData then
local banEnd = banData[1]
if os.time() >= banEnd then
pcall(function()
ds:RemoveAsync(plr.UserId .. "Banned")
end)
else
local banReason = banData[2]
local dateInfo = os.date("!*t", banEnd)
local dateFormatted = dateInfo["day"] .. "/" .. dateInfo["month"] .. "/" .. dateInfo["year"] .. " " .. dateInfo["hour"] .. ":" .. dateInfo["min"] .. ":" .. dateInfo["sec"]
local banMessage = "Banned for: " .. banReason .. " | Ends: " .. dateFormatted
plr:Kick(banMessage)
end
end
--Mute players or unmute them if mute time is over
local muteSuccess, muteData = pcall(function()
local data = ds:GetAsync(plr.UserId .. "Muted")
return data
end)
if muteSuccess and muteData then
local muteEnd = muteData[1]
if os.time() >= muteEnd then
pcall(function()
ds:RemoveAsync(plr.UserId .. "Muted")
end)
else
channel:MuteSpeaker(plr.Name)
local timeToUnmute = muteEnd - os.time()
task.wait(timeToUnmute)
if plr then
channel:UnmuteSpeaker(plr.Name)
end
end
end
end)
|
----- hot tap handler -----
|
hotTap.Interactive.ClickDetector.MouseClick:Connect(function()
if hotOn.Value == false then
hotOn.Value = true
faucet.ParticleEmitter.Enabled = true
waterSound:Play()
hotTap:SetPrimaryPartCFrame(hotTap.PrimaryPart.CFrame * CFrame.Angles(0, math.rad(45), 0))
else
hotOn.Value = false
if coldOn.Value == false then
faucet.ParticleEmitter.Enabled = false
waterSound:Stop()
end
hotTap:SetPrimaryPartCFrame(hotTap.PrimaryPart.CFrame * CFrame.Angles(0, math.rad(-45), 0))
end
end)
|
--[[
ETC
]]
|
local random = Random.new()
local EventData = ReplicatedStorage.Events.EventData
EventData.OnServerEvent:Connect(function(player, cmd, ...)
if cmd == "SpectatePlayer" then
local playerToSpectate = ...
if not Util.playerIsAlive(player) and Util.playerIsAlive(playerToSpectate) then
player.ReplicationFocus = playerToSpectate.Character.Head
end
end
end)
local RespawnEvent = ReplicatedStorage.Events.RespawnEvent
RespawnEvent.Event:Connect(function(player)
if gameStageHandler.currentStageClassName == "Gameplay" and player and player.Character then
wait(Conf.respawnTime)
if not Util.playerIsAlive(player) then
-- Save all player's weapon names to give them new instances of them when they respawn
local toolNamesBeforeDeath = {}
for _, instance in pairs(player.Backpack:GetChildren()) do
if instance:IsA("Tool") and ReplicatedStorage.Assets.Weapons:FindFirstChild(instance.Name) then
table.insert(toolNamesBeforeDeath, instance.Name)
end
end
local characterAddedConn = nil
characterAddedConn = player.CharacterAdded:Connect(function(character)
characterAddedConn:Disconnect()
-- Wait a frame for the character to initialize/spawn
RunService.Heartbeat:Wait()
-- Add weapons the player had before dying to their backpack
for _, weaponName in ipairs(toolNamesBeforeDeath) do
local weaponTemplate = ReplicatedStorage.Assets.Weapons:FindFirstChild(weaponName)
if weaponTemplate ~= nil then
weaponTemplate:Clone().Parent = player.Backpack
end
end
-- Set up the player's character when they respawn
local head = character:WaitForChild("Head")
-- Calculate where to spawn player based on storm's current target position/radius
local targetPos, targetRadius = ShrinkingBarrier.getNextPositionAndRadius()
local randomRadius = targetRadius * random:NextNumber(Conf.respawn_radius_lowest_fraction, Conf.respawn_radius_highest_fraction)
local randomRadians = random:NextNumber(0, 2 * math.pi)
if Conf.num_teams == 2 then
-- In team mode, make players spawn only on their team's half of the map
local dividingAngle = ShrinkingBarrier.getDividingAngle()
if PlayerMatchInfo.GetField(player, "teamNumber") == 1 then
randomRadians = random:NextNumber(dividingAngle - math.pi, dividingAngle)
else
randomRadians = random:NextNumber(dividingAngle, dividingAngle + math.pi)
end
end
local xSpawn = targetPos.X + randomRadius * math.cos(randomRadians)
local ySpawn = targetPos.Y + Conf.respawn_height_fraction * Conf.delivery_vehicle_spawn_height
local zSpawn = targetPos.Z + randomRadius * math.sin(randomRadians)
head.CFrame = CFrame.new(xSpawn, ySpawn, zSpawn)
player.ReplicationFocus = head
end)
Util.loadCharacter(player)
end
end
end)
if not PingHandler.doingSetup and not PingHandler.didSetup then
PingHandler.setup()
end
|
-- connect events
|
Humanoid.Died:connect(onDied)
Humanoid.Running:connect(onRunning)
Humanoid.Jumping:connect(onJumping)
Humanoid.Climbing:connect(onClimbing)
Humanoid.GettingUp:connect(onGettingUp)
Humanoid.FreeFalling:connect(onFreeFall)
Humanoid.FallingDown:connect(onFallingDown)
Humanoid.Seated:connect(onSeated)
Humanoid.PlatformStanding:connect(onPlatformStanding)
Humanoid.Swimming:connect(onSwimming)
|
--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.Transparency = 1
local Object = Tool.Handle:Clone()
Object.Parent = workspace
Object.Transparency = 0
Object.CanCollide = true
Object.Server.Disabled = false
Object.Stabilize.Disabled = false
Object.Interface.Enabled = true
Object.CFrame = Tool.Handle.CFrame
Object.Velocity = (direction*AttackVelocity) + Vector3.new(0,AttackVelocity/7.5,0)
local rand = 11.25
Object.RotVelocity = Vector3.new(math.random(-rand,rand),math.random(-rand,rand),math.random(-rand,rand))
Object:SetNetworkOwner(getPlayer())
local tag = Instance.new("ObjectValue")
tag.Value = getPlayer()
tag.Name = "creator"
tag.Parent = Object
Tool:Destroy()
end
script.Parent.Power.OnServerEvent:Connect(function(player, Power)
AttackVelocity = Power
end)
Remote.OnServerEvent:Connect(function(player, mousePosition)
if not AttackAble then return end
AttackAble = false
if Humanoid and Humanoid.RigType == Enum.HumanoidRigType.R15 then
Remote:FireClient(getPlayer(), "PlayAnimation", "Animation")
end
local targetPos = mousePosition.p
local lookAt = (targetPos - Character.Head.Position).unit
Toss(lookAt)
LeftDown = true
end)
function onLeftUp()
LeftDown = false
end
Tool.Equipped:Connect(function()
Character = Tool.Parent
Humanoid = Character:FindFirstChildOfClass("Humanoid")
end)
Tool.Unequipped:Connect(function()
Character = nil
Humanoid = nil
end)
|
-- The core 'ProcessReceipt' callback function
|
local function processReceipt(receiptInfo)
-- Determine if the product was already granted by checking the data store
local playerProductKey = receiptInfo.PlayerId .. "_" .. receiptInfo.PurchaseId
local purchased = false
local success, errorMessage = pcall(function()
purchased = purchaseHistoryStore:GetAsync(playerProductKey)
end)
-- If purchase was recorded, the product was already granted
if success and purchased then
return Enum.ProductPurchaseDecision.PurchaseGranted
end
-- Find the player who made the purchase in the server
local player = Players:GetPlayerByUserId(receiptInfo.PlayerId)
if not player then
-- The player probably left the game
-- If they come back, the callback will be called again
return Enum.ProductPurchaseDecision.NotProcessedYet
end
-- Look up handler function from 'productFunctions' table above
local handler =_G.HandlePurchase
-- Call the handler function and catch any errors
local success, result = pcall(handler, receiptInfo, receiptInfo.PlayerId)
if not success or not result then
warn("Error occurred while processing a product purchase")
print("\nProductId:", receiptInfo.ProductId)
print("\nPlayer:", player)
_G.FinishedPurchase(receiptInfo.PlayerId,0,false)
return Enum.ProductPurchaseDecision.NotProcessedYet
end
-- Record transaction in data store so it isn't granted again
local success, errorMessage = pcall(function()
purchaseHistoryStore:SetAsync(playerProductKey, true)
end)
if not success then
error("Cannot save purchase data: " .. errorMessage)
end
-- IMPORTANT: Tell Roblox that the game successfully handled the purchase
return Enum.ProductPurchaseDecision.PurchaseGranted
end
|
--for i, model in pairs(GameFolder) do
|
--ContentProvider:PreloadAsync({model})
--Loaded += 1
--Gui.Frame.TextLabel.Text = Loaded.."/"..toLoad.. " asset loaded"
|
--- RUNTIME ---
|
while true do
-- Get closest character head
ClosestHead = nil
ClosestDistance = MaxDistance
CharacterHeads = {}
for _, Character in pairs(workspace.Characters:GetChildren()) do
if Character:IsA("Model") and Character:FindFirstChild("Head") then
table.insert(CharacterHeads, Character.Head)
end
end
for _, Head in pairs(CharacterHeads) do
Distance = (Head.Position - NPCHead.Position).Magnitude
if Distance < ClosestDistance then
ClosestDistance = Distance
ClosestHead = Head
end
end
-- Look at closest character head or reset to original position if none found
if ClosestHead ~= nil then
-- Look at
TweenService:Create(NPCHead, TweenInfo.new(0.5), {CFrame=lookAt(NPCHead.Position, ClosestHead.Position)}):Play()
else
TweenService:Create(NPCHead, TweenInfo.new(0.5), {CFrame=OriginalHeadCF}):Play()
end
wait()
end
|
-- Connect the toggle function to the button's clicked event
|
textButton.MouseButton1Click:Connect(toggleFrames)
|
--script.Parent.Parent.Mover2.part.Anchored = true
|
script.Parent.Parent.Mover2.part.PrismaticConstraint.Speed = 0
script.Parent.Parent.Mover2.part.PrismaticConstraint.TargetPosition = script.Parent.Parent.Mover1.part.PrismaticConstraint.CurrentPosition
script.Parent.Parent.Right.BrickColor = BrickColor.new("Black")
script.Parent.Parent.Plays.Time.Disabled = true
script.Parent.Parent.Plays.SurfaceGui.TextLabel.Text = "00"
script.Parent.Parent.Configuration.Drop.Value = true
wait(1)
script.Parent.Parent.Grabber.Claw.Drop.Disabled = false
script.Disabled = true
end
end
end
script.Parent.ClickDetector.MouseClick:Connect(onClicked)
|
--[[**
ensures value is a number and non-NaN
@param value The value to check against
@returns True iff the condition is satisfied, false otherwise
**--]]
|
function t.number(value)
local valueType = typeof(value)
if valueType == "number" then
if value == value then
return true
else
return false
end
else
return false
end
end
|
--//Setup//--
|
local Chunks = game.Workspace.Chunks
local Seed = math.random(1, 10e6)
|
--[[Engine]]
|
-- [TORQUE CURVE VISUAL]
-- Gas Engine: https://www.desmos.com/calculator/nap6stpjqf
-- Electric Engine: https://www.desmos.com/calculator/ion9q7zp9t
-- Use sliders to manipulate values
-- Edit everything as if your car is NATURALLY aspirated, or as if it lacks a turbo.
Tune.Engine = true -- Enables or disables gas engine
-- TORQUE CURVE: https://www.desmos.com/calculator/nap6stpjqf
Tune.Horsepower = 325
Tune.IdleRPM = 700
Tune.PeakRPM = 6000
Tune.Redline = 6500
Tune.EqPoint = 5252
Tune.PeakSharpness = 20
Tune.CurveMult = 0.2
Tune.Electric = false -- Enables or disables electric engine
-- TORQUE CURVE: https://www.desmos.com/calculator/ion9q7zp9t
Tune.ElecHorsepower = 223
Tune.ElecMaxTorque = 173
Tune.ElecTransition1 = 4000
Tune.ElecHpFrontMult = 0.15
Tune.ElecTransition2 = 9000
Tune.ElecHpEndMult = 2.9
Tune.ElecHpEndPercent = 10
Tune.ElecTqEndMult = 1.5
Tune.ElecTqEndPercent = 27
Tune.ElecRedline = 16000
Tune.InclineComp = 1.2 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Turbo Settings
Tune.Aspiration = "Single" --[[
[Aspiration]
"Natural" : N/A, Naturally aspirated engine
"Single" : Single turbocharger
"Double" : Twin turbocharger
"Super" : Supercharger ]]
Tune.Boost = 5 -- Max PSI (If you have two turbos and this is 15, the PSI will be 30)
Tune.TurboSize = 80 -- Turbo size; the bigger it is, the more lag it has.
Tune.CompressRatio = 6 -- The compression ratio (look it up)
Tune.Sensitivity = 0.05 -- How quickly the Supercharger (if appllied) will bring boost when throttle is applied. (Increment applied per tick, suggested values from 0.05 to 0.1)
--Misc
Tune.RevAccel = 250 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.Flywheel = 500 -- Flywheel weight (higher = faster response, lower = more stable RPM)
|
-- Save next to a local variable for better performance
|
local next = next
local isServer = RunService:IsServer()
local ADDED_OBJECT = "ADDED_OBJECT_CHANGE_TYPE"
local REMOVED_OBJECT = "REMOVED_OBJECT_CHANGE_TYPE"
local DEBUG = false
local ContentsManager = {}
ContentsManager.__index = ContentsManager
function ContentsManager.new(grid, folder, masterContentsManager)
local newContentsManager = {}
newContentsManager.contents = {}
newContentsManager.grid = grid
newContentsManager.masterContentsManager = masterContentsManager
newContentsManager.connections = {}
newContentsManager.contentsListenerCount = 0
newContentsManager.contentsListeners = {}
setmetatable(newContentsManager, ContentsManager)
if type(folder) == "string" then
newContentsManager.folder = Instance.new("Folder")
newContentsManager.folder.Name = folder
newContentsManager.folder.Parent = game.Workspace
else
newContentsManager.folder = folder
for _, child in ipairs(newContentsManager.folder:GetChildren()) do
newContentsManager:_onChildAddedToContentsFolder(child)
end
newContentsManager.connections.objectAddedToContentsFolder =
newContentsManager.folder.ChildAdded:Connect(function(childAdded)
newContentsManager:_onChildAddedToContentsFolder(childAdded)
end)
end
if masterContentsManager then
masterContentsManager:addContentsListener(function(change)
newContentsManager:_onMasterContentsChanged(change)
end)
end
return newContentsManager
end
local function Vector3FromString(str)
local vector3Values = {}
for num in str:gmatch("[^,]+") do
table.insert(vector3Values, tonumber(num))
end
return Vector3.new(vector3Values[1], vector3Values[2], vector3Values[3])
end
function ContentsManager:_onChildAddedToContentsFolder(child)
local childName = child.Name
local objectTypeName = string.sub(childName, 1, string.find(childName, "|") - 1)
local objectType = self.grid.objectTypes[objectTypeName]
if objectType then
local _, _, _, cellName = objectType.fromString(childName)
self:add(objectType, self:_allocateCell(Vector3FromString(cellName)).id, child, true)
else
warn("Child with improper name " .. child.Name .. " added to contents folder")
end
end
function ContentsManager:addContentsListener(func)
if not self.contentsListeners[func] then
self.contentsListeners[func] = true
self.contentsListenerCount = self.contentsListenerCount + 1
end
end
function ContentsManager:removeContentsListener(func)
if self.contentsListener[func] then
self.contentsListener[func] = nil
self.contentsListenerCount = self.contentsListenerCount - 1
end
end
function ContentsManager:_onMasterContentsChanged(change)
-- TODO: Remove conflicting temp objects and
-- temp objects that are no longer connected to the rest of the structure
if change.type == ADDED_OBJECT then
self:remove(change.objectType, tostring(change.cellId))
elseif change.type == REMOVED_OBJECT then
self:remove(change.objectType, tostring(change.cellId), true, change.doNotDestroy)
else
error("Received master contents change with invalid type")
end
end
function ContentsManager:canPlace(objectType, cellId)
return self:_spaceAvailable(objectType, cellId) and self:_connected(objectType, cellId)
end
function ContentsManager:_spaceAvailable(objectType, cellId)
local masterSpaceAvailable = true
if self.masterContentsManager then
masterSpaceAvailable = self.masterContentsManager:_spaceAvailable(objectType, cellId)
end
local spaceAvailable = not bit32.btest(objectType.occupancy, self:getCell(cellId).occupancy)
return masterSpaceAvailable and spaceAvailable
end
function ContentsManager:getCell(cellId)
local cell = self.contents[tostring(cellId)]
if cell then
return cell
end
return Cell.new(self.grid, cellId)
end
function ContentsManager:_connected(objectType, cellId)
local cell = self:getCell(cellId)
if self.masterContentsManager and self.masterContentsManager:_connected(objectType, cellId) then
return true
end
local connections = bit32.band(objectType.connectivity, cell.connectivity)
if BitOps.numOfSetBits(connections) >= 2 then
-- Check that at least two connections are to the same adjacent grid object
local setOfConnectedObjects = {}
for i = 0, 23 do
local key = tostring(i)
if bit32.extract(objectType.connectivity, i) == 1 and cell.connectivityMap[key] ~= nil then
for object in pairs(cell.connectivityMap[key]) do
if setOfConnectedObjects[object] then
return true
else
setOfConnectedObjects[object] = true
end
end
end
end
end
local touchingScenery = self:_getTouchingScenery(cellId, objectType)
local touchingScenerySize = 0
for _ in pairs(touchingScenery) do
touchingScenerySize = touchingScenerySize + 1
end
if touchingScenerySize > 0 then
return true
end
return false
end
|
-- shut the front door
-- create door welds if we don't have them yet
|
weld1 = doorPart1:FindFirstChild("DoorWeld")
weld2 = doorPart2:FindFirstChild("DoorWeld")
if not weld1 or not weld2 then
if weld1 then weld1:Remove() end
if weld2 then weld2:Remove() end
newDoorWeld = Instance.new("ManualWeld")
newDoorWeld.Part0 = doorPart1
newDoorWeld.Part1 = outerEdge
newDoorWeld.C1 = weld1RelativePosition
newDoorWeld.Name = "DoorWeld"
newDoorWeld.Parent = doorPart1
newDoorWeld = Instance.new("ManualWeld")
newDoorWeld.Part0 = doorPart2
newDoorWeld.Part1 = outerEdge
newDoorWeld.C1 = weld2RelativePosition
newDoorWeld.Name = "DoorWeld"
newDoorWeld.Parent = doorPart2
else
weld1.C1 = weld1RelativePosition
weld2.C1 = weld2RelativePosition
end
isOpen = false
doorTouch1.Touched:connect(touchEvent)
doorTouch2.Touched:connect(touchEvent)
print("REACHED END")
|
-- end of object table data
|
function GetBaseSize()
local Size = Vector3.new(0,0,0)
local mySize = Self.Size
local Mesh = Self:findFirstChild("Mesh")
if(Mesh ~= nil) then
Size = Vector3.new((mySize.X*Mesh.Scale.X),
(mySize.Y*Mesh.Scale.Y),
(mySize.Z*Mesh.Scale.Z))
else
Size = mySize
end
return Size
end
function GetBasePosition()
local Pos = Vector3.new(0,0,0)
local myPos = Self.Position
local Mesh = Self:findFirstChild("Mesh")
if(Mesh ~= nil) then
Pos = Vector3.new((myPos.X+Mesh.Offset.X),
(myPos.Y+Mesh.Offset.Y),
(myPos.Z+Mesh.Offset.Z))
else
Pos = myPos
end
return Pos
end
local AreaOfEffect = GetBaseSize()
local MyBasePos = GetBasePosition()
function CheckMats(part)
local isBoyant = false
for i=1,#FloatMats do
if(part.Material == Enum.Material[FloatMats[i]]) then
isBoyant = true
end
end
return isBoyant
end
function isinArea(part) --main function to check if parts are within an area
isIT = false
if(part~= nil) then
local Area = AreaOfEffect
local PartSize = part.Size
local MyPos = MyBasePos
local PartPos = part.Position
if((PartPos.Y+(PartSize.Y/2) > MyPos.Y-(Area.Y/2))
and(PartPos.Y-(PartSize.Y/2) < MyPos.Y+(Area.Y/2))) then
if((PartPos.X+(PartSize.X/2) > MyPos.X-(Area.X/2))
and(PartPos.X-(PartSize.X/2) < MyPos.X+(Area.X/2))) then
if((PartPos.Z+(PartSize.Z/2) > MyPos.Z-(Area.Z/2))
and(PartPos.Z-(PartSize.Z/2) < MyPos.Z+(Area.Z/2))) then -- should be in the volume
isIT = true
end
end
end
end
return isIT
end
while true do
for i =1,#WorkSpaceObjects do
if(WorkSpaceObjects[i] ~= nil)then
if(WorkSpaceObjects[i].Parent ~= nil) then
if(CheckMats(WorkSpaceObjects[i]) == true) then
if(WorkSpaceObjects[i]:findFirstChild("BoyancyTimes")~= nil) then
Mass = WorkSpaceObjects[i]:GetMass()*(230*WorkSpaceObjects[i].BoyancyTimes.Value)
else
Mass = WorkSpaceObjects[i]:GetMass()*230
end
else
Mass = WorkSpaceObjects[i]:GetMass()*150
end
inArea = isinArea(WorkSpaceObjects[i])
BoyantPos_Y = MyBasePos.Y + ((AreaOfEffect.Y/2))
if(inArea == true) then
if(WorkSpaceObjects[i]:findFirstChild("WaterForce") == nil) then
BP = Instance.new("BodyPosition")
BP.Parent = WorkSpaceObjects[i]
BP.Name = "WaterForce"
if(WorkSpaceObjects[i].Parent:findFirstChild("Humanoid") ~= nil) then
BP.D = 1.25e+004
BP.P = 1e+005
BP.position=Vector3.new(0,BoyantPos_Y+25,0)
BP.maxForce = Vector3.new(0,Mass*1.5,0)
else
BP.D = 1.25e+003
BP.P = 1e+004
BP.position=Vector3.new(0,BoyantPos_Y,0)
BP.maxForce = Vector3.new(0,Mass,0)
end
end
if(WorkSpaceObjects[i]:findFirstChild("WaterForce") ~= nil) then
if(WorkSpaceObjects[i].Parent:findFirstChild("Humanoid") ~= nil) then
BP = WorkSpaceObjects[i].WaterForce
if(WorkSpaceObjects[i].Parent.Humanoid.Jump == true) then
BP.position=Vector3.new(0,BoyantPos_Y+50,0)
BP.maxForce = Vector3.new(0,Mass*4,0)
tick = tick +1
if(tick >= resetTick) then
tick = 0
WorkSpaceObjects[i].Parent.Humanoid.Jump = false
end
else
BP.position=Vector3.new(0,BoyantPos_Y+1,0)
BP.maxForce = Vector3.new(0,Mass*2,0)
end
end
end
else
if(WorkSpaceObjects[i] ~= nil)then
if(WorkSpaceObjects[i]:findFirstChild("WaterForce") ~= nil) then
WorkSpaceObjects[i].WaterForce:remove()
end
end
end
end
end
end
--print(#WorkSpaceObjects)
wait()
end
|
--[[
Api.Classes
Api.Enums
Api.GetProperties(className)
Api.IsEnum(valueType)
--]]
| |
-- Function to calculate fall damage based on fall distance
|
local function calculateFallDamage(fallDistance)
local baseDamage = 10
local damageScale = 1
local extraFallDistance = fallDistance - MAX_FALL_DISTANCE
local damage = baseDamage + (extraFallDistance * damageScale)
return damage
end
|
--------| Variables |--------
|
local selectionBlacklist = {}
local blacklistSet = false
|
-- ROBLOX services
|
local Teams = game:GetService("Teams")
local Players = game:GetService("Players")
local ServerStorage = game:GetService("ServerStorage")
|
-- firing
|
GUI.MobileButtons.FireButton.MouseButton1Down:connect(function()
Down = true
local IsChargedShot = false
if Equipped and Enabled and Down and not Reloading and not HoldDown and Mag > 0 and Humanoid.Health > 0 then
Enabled = false
if Module.ChargedShotEnabled then
if HandleToFire:FindFirstChild("ChargeSound") then HandleToFire.ChargeSound:Play() end
wait(Module.ChargingTime)
IsChargedShot = true
end
if Module.MinigunEnabled then
if HandleToFire:FindFirstChild("WindUp") then HandleToFire.WindUp:Play() end
wait(Module.DelayBeforeFiring)
end
while Equipped and not Reloading and not HoldDown and (Down or IsChargedShot) and Mag > 0 and Humanoid.Health > 0 do
IsChargedShot = false
Player.PlayerScripts.BulletVisualizerScript.VisualizeM:Fire(nil,HandleToFire,
Module.MuzzleFlashEnabled,
{Module.MuzzleLightEnabled,Module.LightBrightness,Module.LightColor,Module.LightRange,Module.LightShadows,Module.VisibleTime},
script:WaitForChild("MuzzleEffect"))
VisualizeMuzzle:FireServer(HandleToFire,
Module.MuzzleFlashEnabled,
{Module.MuzzleLightEnabled,Module.LightBrightness,Module.LightColor,Module.LightRange,Module.LightShadows,Module.VisibleTime},
script:WaitForChild("MuzzleEffect"))
for i = 1,(Module.BurstFireEnabled and Module.BulletPerBurst or 1) do
spawn(RecoilCamera)
EjectShell(HandleToFire)
CrosshairModule.crossspring:accelerate(Module.CrossExpansion)
for x = 1,(Module.ShotgunEnabled and Module.BulletPerShot or 1) do
Fire(HandleToFire, GUI.Crosshair.AbsolutePosition)
end
Mag = Mag - 1
ChangeMagAndAmmo:FireServer(Mag,Ammo)
UpdateGUI()
if Module.BurstFireEnabled then wait(Module.BurstRate) end
if Mag <= 0 then break end
end
HandleToFire = (HandleToFire == Handle and Module.DualEnabled) and Handle2 or Handle
wait(Module.FireRate)
if not Module.Auto then break end
end
if HandleToFire.FireSound.Playing and HandleToFire.FireSound.Looped then HandleToFire.FireSound:Stop() end
if Module.MinigunEnabled then
if HandleToFire:FindFirstChild("WindDown") then HandleToFire.WindDown:Play() end
wait(Module.DelayAfterFiring)
end
Enabled = true
if Mag <= 0 then Reload() end
end
end)
|
--[[
@under MarketPlaceManager
Handles all product managing including badges.
.AwardBadge:
@arg func return true: AwardsBadge
]]
|
local module = {}
|
-- Attacher la fonction à l'événement d'entrée de l'Utilisateur
|
UIS.InputBegan:Connect(function(input, gameProcessed)
if not gameProcessed and input.KeyCode == Enum.KeyCode.F then
toggleMouseVisibilityAndMovement()
end
end)
|
--Public developer facing functions
|
function ClickToMove:SetShowPath(value)
ShowPath = value
end
function ClickToMove:GetShowPath()
return ShowPath
end
function ClickToMove:SetWaypointTexture(texture)
ClickToMoveDisplay.SetWaypointTexture(texture)
end
function ClickToMove:GetWaypointTexture()
return ClickToMoveDisplay.GetWaypointTexture()
end
function ClickToMove:SetWaypointRadius(radius)
ClickToMoveDisplay.SetWaypointRadius(radius)
end
function ClickToMove:GetWaypointRadius()
return ClickToMoveDisplay.GetWaypointRadius()
end
function ClickToMove:SetEndWaypointTexture(texture)
ClickToMoveDisplay.SetEndWaypointTexture(texture)
end
function ClickToMove:GetEndWaypointTexture()
return ClickToMoveDisplay.GetEndWaypointTexture()
end
function ClickToMove:SetWaypointsAlwaysOnTop(alwaysOnTop)
ClickToMoveDisplay.SetWaypointsAlwaysOnTop(alwaysOnTop)
end
function ClickToMove:GetWaypointsAlwaysOnTop()
return ClickToMoveDisplay.GetWaypointsAlwaysOnTop()
end
function ClickToMove:SetFailureAnimationEnabled(enabled)
PlayFailureAnimation = enabled
end
function ClickToMove:GetFailureAnimationEnabled()
return PlayFailureAnimation
end
function ClickToMove:SetIgnoredPartsTag(tag)
UpdateIgnoreTag(tag)
end
function ClickToMove:GetIgnoredPartsTag()
return CurrentIgnoreTag
end
function ClickToMove:SetUseDirectPath(directPath)
UseDirectPath = directPath
end
function ClickToMove:GetUseDirectPath()
return UseDirectPath
end
function ClickToMove:SetAgentSizeIncreaseFactor(increaseFactorPercent: number)
AgentSizeIncreaseFactor = 1.0 + (increaseFactorPercent / 100.0)
end
function ClickToMove:GetAgentSizeIncreaseFactor()
return (AgentSizeIncreaseFactor - 1.0) * 100.0
end
function ClickToMove:SetUnreachableWaypointTimeout(timeoutInSec)
UnreachableWaypointTimeout = timeoutInSec
end
function ClickToMove:GetUnreachableWaypointTimeout()
return UnreachableWaypointTimeout
end
function ClickToMove:SetUserJumpEnabled(jumpEnabled)
self.jumpEnabled = jumpEnabled
if self.touchJumpController then
self.touchJumpController:Enable(jumpEnabled)
end
end
function ClickToMove:GetUserJumpEnabled()
return self.jumpEnabled
end
function ClickToMove:MoveTo(position, showPath, useDirectPath)
local character = Player.Character
if character == nil then
return false
end
local thisPather = Pather(position, Vector3.new(0, 1, 0), useDirectPath)
if thisPather and thisPather:IsValidPath() then
HandleMoveTo(thisPather, position, nil, character, showPath)
return true
end
return false
end
return ClickToMove
|
--[[Brakes]]
|
Tune.ABSEnabled = true -- Implements ABS
Tune.ABSThreshold = 20 -- Slip speed allowed before ABS starts working (in SPS)
Tune.BrakeForce = 2500 -- Total brake force (LuaInt)
Tune.BrakeBias = .57 -- Brake bias towards the front, percentage (1 = Front, 0 = Rear, .5 = 50/50)
Tune.PBrakeForce = 5000 -- Handbrake force
Tune.EBrakeForce = 250 -- Engine braking force at redline
|
--// Input Connections
|
L_107_.InputBegan:connect(function(L_314_arg1, L_315_arg2)
if not L_315_arg2 and L_15_ then
if L_314_arg1.UserInputType == (Enum.UserInputType.MouseButton2 or L_314_arg1.KeyCode == Enum.KeyCode.ButtonL2) and not L_79_ and not L_78_ and not L_77_ and L_24_.CanAim and not L_74_ and L_15_ and not L_66_ and not L_67_ then
if not L_64_ then
if not L_65_ then
if L_24_.TacticalModeEnabled then
L_154_ = 0.015
L_155_ = 7
L_3_:WaitForChild("Humanoid").WalkSpeed = 7
else
L_155_ = 10
L_154_ = 0.008
L_3_:WaitForChild("Humanoid").WalkSpeed = 10
end
end
if (L_3_.Head.Position - L_5_.CoordinateFrame.p).magnitude <= 2 then
L_97_ = L_50_
end
L_133_.target = L_56_.CFrame:toObjectSpace(L_44_.CFrame).p
L_115_:FireServer(true)
L_64_ = true
end
end;
if L_314_arg1.KeyCode == Enum.KeyCode.A and L_15_ then
L_134_ = CFrame.Angles(0, 0, 0.1)
end;
if L_314_arg1.KeyCode == Enum.KeyCode.D and L_15_ then
L_134_ = CFrame.Angles(0, 0, -0.1)
end;
if L_314_arg1.KeyCode == Enum.KeyCode.E and L_15_ and not L_80_ and not L_81_ then
L_80_ = true
L_82_ = false
L_81_ = true
LeanRight()
end
if L_314_arg1.KeyCode == Enum.KeyCode.Q and L_15_ and not L_80_ and not L_82_ then
L_80_ = true
L_81_ = false
L_82_ = true
LeanLeft()
end
if L_314_arg1.KeyCode == L_24_.AlternateAimKey and not L_79_ and not L_78_ and not L_77_ and L_24_.CanAim and not L_74_ and L_15_ and not L_66_ and not L_67_ then
if not L_64_ then
if not L_65_ then
L_3_.Humanoid.WalkSpeed = 10
L_155_ = 10
L_154_ = 0.008
end
L_97_ = L_50_
L_133_.target = L_56_.CFrame:toObjectSpace(L_44_.CFrame).p
L_115_:FireServer(true)
L_64_ = true
end
end;
if L_314_arg1.UserInputType == (Enum.UserInputType.MouseButton1 or L_314_arg1.KeyCode == Enum.KeyCode.ButtonR2) and not L_79_ and not L_77_ and L_69_ and L_15_ and not L_66_ and not L_67_ and not L_74_ then
L_68_ = true
if not Shooting and L_15_ and not L_83_ then
if L_103_ > 0 then
Shoot()
end
elseif not Shooting and L_15_ and L_83_ then
if L_105_ > 0 then
Shoot()
end
end
end;
if L_314_arg1.KeyCode == (L_24_.LaserKey or L_314_arg1.KeyCode == Enum.KeyCode.DPadRight) and L_15_ and L_24_.LaserAttached then
local L_316_ = L_1_:FindFirstChild("LaserLight")
L_122_.KeyDown[1].Plugin()
end;
if L_314_arg1.KeyCode == (L_24_.LightKey or L_314_arg1.KeyCode == Enum.KeyCode.ButtonR3) and L_15_ and L_24_.LightAttached then
local L_317_ = L_1_:FindFirstChild("FlashLight"):FindFirstChild('Light')
local L_318_ = false
L_317_.Enabled = not L_317_.Enabled
end;
if L_15_ and L_314_arg1.KeyCode == (L_24_.FireSelectKey or L_314_arg1.KeyCode == Enum.KeyCode.DPadUp) and not L_79_ and not L_70_ and not L_78_ then
L_70_ = true
if L_92_ == 1 then
if Shooting then
Shooting = false
end
if L_24_.AutoEnabled then
L_92_ = 2
L_83_ = false
L_69_ = L_84_
elseif not L_24_.AutoEnabled and L_24_.BurstEnabled then
L_92_ = 3
L_83_ = false
L_69_ = L_84_
elseif not L_24_.AutoEnabled and not L_24_.BurstEnabled and L_24_.BoltAction then
L_92_ = 4
L_83_ = false
L_69_ = L_84_
elseif not L_24_.AutoEnabled and not L_24_.BurstEnabled and not L_24_.BoltAction and L_24_.ExplosiveEnabled then
L_92_ = 6
L_83_ = true
L_84_ = L_69_
L_69_ = L_85_
elseif not L_24_.AutoEnabled and not L_24_.BurstEnabled and not L_24_.BoltAction and not L_24_.ExplosiveEnabled then
L_92_ = 1
L_83_ = false
L_69_ = L_84_
end
elseif L_92_ == 2 then
if Shooting then
Shooting = false
end
if L_24_.BurstEnabled then
L_92_ = 3
L_83_ = false
L_69_ = L_84_
elseif not L_24_.BurstEnabled and L_24_.BoltAction then
L_92_ = 4
L_83_ = false
L_69_ = L_84_
elseif not L_24_.BurstEnabled and not L_24_.BoltAction and L_24_.ExplosiveEnabled then
L_92_ = 6
L_83_ = true
L_84_ = L_69_
L_69_ = L_85_
elseif not L_24_.BurstEnabled and not L_24_.BoltAction and not L_24_.ExplosiveEnabled and L_24_.SemiEnabled then
L_92_ = 1
L_83_ = false
L_69_ = L_84_
elseif not L_24_.BurstEnabled and not L_24_.BoltAction and not L_24_.SemiEnabled then
L_92_ = 2
L_83_ = false
L_69_ = L_84_
end
elseif L_92_ == 3 then
if Shooting then
Shooting = false
end
if L_24_.BoltAction then
L_92_ = 4
L_83_ = false
L_69_ = L_84_
elseif not L_24_.BoltAction and L_24_.ExplosiveEnabled then
L_92_ = 6
L_83_ = true
L_84_ = L_69_
L_69_ = L_85_
elseif not L_24_.BoltAction and not L_24_.ExplosiveEnabled and L_24_.SemiEnabled then
L_92_ = 1
L_83_ = false
L_69_ = L_84_
elseif not L_24_.BoltAction and not L_24_.SemiEnabled and L_24_.AutoEnabled then
L_92_ = 2
L_83_ = false
L_69_ = L_84_
elseif not L_24_.BoltAction and not L_24_.SemiEnabled and not L_24_.AutoEnabled then
L_92_ = 3
L_83_ = false
L_69_ = L_84_
end
elseif L_92_ == 4 then
if Shooting then
Shooting = false
end
if L_24_.ExplosiveEnabled then
L_92_ = 6
L_83_ = true
L_84_ = L_69_
L_69_ = L_85_
elseif not L_24_.ExplosiveEnabled and L_24_.SemiEnabled then
L_92_ = 1
L_83_ = false
L_69_ = L_84_
elseif not L_24_.SemiEnabled and L_24_.AutoEnabled then
L_92_ = 2
L_83_ = false
L_69_ = L_84_
elseif not L_24_.SemiEnabled and not L_24_.AutoEnabled and L_24_.BurstEnabled then
L_92_ = 3
L_83_ = false
L_69_ = L_84_
elseif not L_24_.SemiEnabled and not L_24_.AutoEnabled and not L_24_.BurstEnabled then
L_92_ = 4
L_83_ = false
L_69_ = L_84_
end
elseif L_92_ == 6 then
if Shooting then
Shooting = false
end
L_85_ = L_69_
if L_24_.SemiEnabled then
L_92_ = 1
L_83_ = false
L_69_ = L_84_
elseif not L_24_.SemiEnabled and L_24_.AutoEnabled then
L_92_ = 2
L_83_ = false
L_69_ = L_84_
elseif not L_24_.SemiEnabled and not L_24_.AutoEnabled and L_24_.BurstEnabled then
L_92_ = 3
L_83_ = false
L_69_ = L_84_
elseif not L_24_.SemiEnabled and not L_24_.AutoEnabled and not L_24_.BurstEnabled and L_24_.BoltAction then
L_92_ = 4
L_83_ = false
L_69_ = L_84_
elseif not L_24_.SemiEnabled and not L_24_.AutoEnabled and not L_24_.BurstEnabled and not L_24_.BoltAction then
L_92_ = 6
L_83_ = true
L_84_ = L_69_
L_69_ = L_85_
end
end
UpdateAmmo()
FireModeAnim()
IdleAnim()
L_70_ = false
end;
if L_314_arg1.KeyCode == (Enum.KeyCode.F or L_314_arg1.KeyCode == Enum.KeyCode.DPadDown) and not L_79_ and not L_77_ and not L_78_ and not L_67_ and not L_70_ and not L_64_ and not L_66_ and not Shooting and not L_76_ then
if not L_73_ and not L_74_ then
L_74_ = true
Shooting = false
L_69_ = false
L_135_ = time()
delay(0.6, function()
if L_103_ ~= L_24_.Ammo and L_103_ > 0 then
CreateShell()
end
end)
BoltBackAnim()
L_73_ = true
elseif L_73_ and L_74_ then
BoltForwardAnim()
Shooting = false
L_69_ = true
if L_103_ ~= L_24_.Ammo and L_103_ > 0 then
L_103_ = L_103_ - 1
elseif L_103_ >= L_24_.Ammo then
L_69_ = true
end
L_73_ = false
L_74_ = false
IdleAnim()
L_75_ = false
end
UpdateAmmo()
end;
if L_314_arg1.KeyCode == (Enum.KeyCode.LeftShift or L_314_arg1.KeyCode == Enum.KeyCode.ButtonL3) and not L_78_ and not L_77_ and L_146_ then
L_71_ = true
if L_15_ and not L_70_ and not L_67_ and L_71_ and not L_65_ and not L_74_ then
Shooting = false
L_64_ = false
L_67_ = true
delay(0, function()
if L_67_ and not L_66_ then
L_64_ = false
L_72_ = true
end
end)
L_97_ = 80
if L_24_.TacticalModeEnabled then
L_154_ = 0.4
L_155_ = 16
else
L_155_ = L_24_.SprintSpeed
L_154_ = 0.4
end
L_3_.Humanoid.WalkSpeed = L_24_.SprintSpeed
end
end;
if L_314_arg1.KeyCode == (Enum.KeyCode.R or L_314_arg1.KeyCode == Enum.KeyCode.ButtonX) and not L_79_ and not L_78_ and not L_77_ and L_15_ and not L_66_ and not L_64_ and not Shooting and not L_67_ and not L_74_ then
if not L_83_ then
if L_104_ > 0 and L_103_ < L_24_.Ammo then
Shooting = false
L_66_ = true
for L_319_forvar1, L_320_forvar2 in pairs(game.Players:GetChildren()) do
if L_320_forvar2 and L_320_forvar2:IsA('Player') and L_320_forvar2 ~= L_2_ and L_320_forvar2.TeamColor == L_2_.TeamColor then
if (L_320_forvar2.Character.HumanoidRootPart.Position - L_3_.HumanoidRootPart.Position).magnitude <= 150 then
if L_7_:FindFirstChild('AHH') and not L_7_.AHH.IsPlaying then
L_119_:FireServer(L_7_.AHH, L_100_[math.random(0, 23)])
end
end
end
end
ReloadAnim()
if L_103_ <= 0 then
if L_24_.CanSlideLock then
BoltBackAnim()
BoltForwardAnim()
end
end
IdleAnim()
L_69_ = true
if L_103_ <= 0 then
if (L_104_ - (L_24_.Ammo - L_103_)) < 0 then
L_103_ = L_103_ + L_104_
L_104_ = 0
else
L_104_ = L_104_ - (L_24_.Ammo - L_103_)
L_103_ = L_24_.Ammo
end
elseif L_103_ > 0 then
if (L_104_ - (L_24_.Ammo - L_103_)) < 0 then
L_103_ = L_103_ + L_104_ + 0
L_104_ = 0
else
L_104_ = L_104_ - (L_24_.Ammo - L_103_)
L_103_ = L_24_.Ammo + 0
end
end
L_66_ = false
if not L_75_ then
L_69_ = true
end
end;
elseif L_83_ then
if L_105_ > 0 then
Shooting = false
L_66_ = true
nadeReload()
IdleAnim()
L_66_ = false
L_69_ = true
end
end;
UpdateAmmo()
end;
if L_314_arg1.KeyCode == Enum.KeyCode.RightBracket and L_64_ then
if (L_51_ < 1) then
L_51_ = L_51_ + L_24_.SensitivityIncrement
end
end
if L_314_arg1.KeyCode == Enum.KeyCode.LeftBracket and L_64_ then
if (L_51_ > 0.1) then
L_51_ = L_51_ - L_24_.SensitivityIncrement
end
end
if L_314_arg1.KeyCode == (Enum.KeyCode.T or L_314_arg1.KeyCode == Enum.KeyCode.DPadLeft) and L_1_:FindFirstChild("AimPart2") then
if not L_86_ then
L_56_ = L_1_:WaitForChild("AimPart2")
L_50_ = L_24_.CycleAimZoom
if L_64_ then
L_97_ = L_24_.CycleAimZoom
end
L_86_ = true
else
L_56_ = L_1_:FindFirstChild("AimPart")
L_50_ = L_24_.AimZoom
if L_64_ then
L_97_ = L_24_.AimZoom
end
L_86_ = false
end;
end;
if L_314_arg1.KeyCode == L_24_.InspectionKey and not L_79_ and not L_78_ then
if not L_77_ then
L_77_ = true
InspectAnim()
IdleAnim()
L_77_ = false
end
end;
if L_314_arg1.KeyCode == L_24_.AttachmentKey and not L_79_ and not L_77_ then
if L_15_ then
if not L_78_ then
L_67_ = false
L_64_ = false
L_69_ = false
L_78_ = true
AttachAnim()
elseif L_78_ then
L_67_ = false
L_64_ = false
L_69_ = true
L_78_ = false
IdleAnim()
end
end
end;
if L_314_arg1.KeyCode == Enum.KeyCode.P and not L_77_ and not L_78_ and not L_64_ and not L_67_ and not L_65_ and not L_66_ and not Recoiling and not L_67_ then
if not L_79_ then
L_79_ = true
L_14_:Create(L_45_, TweenInfo.new(0.2), {
C1 = L_24_.SprintPos
}):Play()
wait(0.2)
L_112_:FireServer("Patrol", L_24_.SprintPos)
else
L_79_ = false
L_14_:Create(L_45_, TweenInfo.new(0.2), {
C1 = CFrame.new()
}):Play()
wait(0.2)
L_112_:FireServer("Unpatrol")
end
end;
end
end)
L_107_.InputEnded:connect(function(L_321_arg1, L_322_arg2)
if not L_322_arg2 and L_15_ then
if L_321_arg1.UserInputType == (Enum.UserInputType.MouseButton2 or L_321_arg1.KeyCode == Enum.KeyCode.ButtonL2) and not L_77_ and L_24_.CanAim and not L_78_ then
if L_64_ then
if not L_65_ then
L_3_:WaitForChild("Humanoid").WalkSpeed = 16
if L_24_.TacticalModeEnabled then
L_154_ = 0.09
L_155_ = 11
else
L_154_ = .2
L_155_ = 17
end
end
L_97_ = 70
L_133_.target = Vector3.new()
L_115_:FireServer(false)
L_64_ = false
end
end;
if L_321_arg1.KeyCode == Enum.KeyCode.A and L_15_ then
L_134_ = CFrame.Angles(0, 0, 0)
end;
if L_321_arg1.KeyCode == Enum.KeyCode.D and L_15_ then
L_134_ = CFrame.Angles(0, 0, 0)
end;
if L_321_arg1.KeyCode == Enum.KeyCode.E and L_15_ and L_80_ then
Unlean()
L_80_ = false
L_82_ = false
L_81_ = false
end
if L_321_arg1.KeyCode == Enum.KeyCode.Q and L_15_ and L_80_ then
Unlean()
L_80_ = false
L_82_ = false
L_81_ = false
end
if L_321_arg1.KeyCode == L_24_.AlternateAimKey and not L_77_ and L_24_.CanAim then
if L_64_ then
if not L_65_ then
L_3_.Humanoid.WalkSpeed = 16
L_155_ = 17
L_154_ = .25
end
L_97_ = 70
L_133_.target = Vector3.new()
L_115_:FireServer(false)
L_64_ = false
end
end;
if L_321_arg1.UserInputType == (Enum.UserInputType.MouseButton1 or L_321_arg1.KeyCode == Enum.KeyCode.ButtonR2) and not L_77_ then
L_68_ = false
if Shooting then
Shooting = false
end
end;
if L_321_arg1.KeyCode == Enum.KeyCode.E and L_15_ then
local L_323_ = L_42_:WaitForChild('GameGui')
if L_16_ then
L_323_:WaitForChild('AmmoFrame').Visible = false
L_16_ = false
end
end;
if L_321_arg1.KeyCode == (Enum.KeyCode.LeftShift or L_321_arg1.KeyCode == Enum.KeyCode.ButtonL3) and not L_77_ and not L_70_ and not L_65_ then -- SPRINT
L_71_ = false
if L_67_ and not L_64_ and not Shooting and not L_71_ then
L_67_ = false
L_72_ = false
L_97_ = 70
L_3_.Humanoid.WalkSpeed = 16
if L_24_.TacticalModeEnabled then
L_154_ = 0.09
L_155_ = 11
else
L_154_ = .2
L_155_ = 17
end
end
end;
end
end)
L_107_.InputChanged:connect(function(L_324_arg1, L_325_arg2)
if not L_325_arg2 and L_15_ and L_24_.FirstPersonOnly and L_64_ then
if L_324_arg1.UserInputType == Enum.UserInputType.MouseWheel then
if L_324_arg1.Position.Z == 1 and (L_51_ < 1) then
L_51_ = L_51_ + L_24_.SensitivityIncrement
elseif L_324_arg1.Position.Z == -1 and (L_51_ > 0.1) then
L_51_ = L_51_ - L_24_.SensitivityIncrement
end
end
end
end)
L_107_.InputChanged:connect(function(L_326_arg1, L_327_arg2)
if not L_327_arg2 and L_15_ then
local L_328_, L_329_ = workspace:FindPartOnRayWithIgnoreList(Ray.new(L_56_.CFrame.p, (L_56_.CFrame.lookVector).unit * 10000), IgnoreList);
if L_328_ then
local L_330_ = (L_329_ - L_6_.Position).magnitude
L_33_.Text = math.ceil(L_330_) .. ' m'
end
end
end)
|
--[[Transmission]]
|
Tune.TransModes = {"Auto", "Semi", "Manual"} --[[
[Modes]
"Auto" : Automatic shifting
"Semi" : Clutchless manual shifting, dual clutch transmission
"Manual" : Manual shifting with clutch
>Include within brackets
eg: {"Semi"} or {"Auto", "Manual"}
>First mode is default mode ]]
--Automatic Settings
Tune.AutoShiftMode = "Speed" --[[
[Modes]
"Speed" : Shifts based on wheel speed
"RPM" : Shifts based on RPM ]]
Tune.AutoUpThresh = -200 --Automatic upshift point (relative to peak RPM, positive = Over-rev)
Tune.AutoDownThresh = 1400 --Automatic downshift point (relative to peak RPM, positive = Under-rev)
--Gear Ratios
Tune.FinalDrive = 3.86 -- Gearing determines top speed and wheel torque
Tune.Ratios = { -- Higher ratio = more torque, Lower ratio = higher top speed
--[[Reverse]] 3.70 , -- Copy and paste a ratio to add a gear
--[[Neutral]] 0 , -- Ratios can also be deleted
--[[ 1 ]] 3.53 , -- Reverse, Neutral, and 1st gear are required
--[[ 2 ]] 2.04 ,
--[[ 3 ]] 1.38 ,
--[[ 4 ]] 1.03 ,
--[[ 5 ]] 0.81 ,
--[[ 6 ]] 0.64 ,
}
Tune.FDMult = 1.5 -- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
|
--[[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 = 10000 -- Steering Force
Tune.SteerP = 30000 -- Steering Aggressiveness
|
--[[
Package link auto-generated by Rotriever
]]
|
local PackageIndex = script.Parent.Parent._Index
local Package = require(PackageIndex["mock"]["mock"])
return Package
|
-- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote
|
local emoteNames = { wave = false, point = false, dance = true, dance2 = true, dance3 = true, laugh = false, cheer = false}
math.randomseed(tick())
function configureAnimationSet(name, fileList)
if (animTable[name] ~= nil) then
for _, connection in pairs(animTable[name].connections) do
connection:disconnect()
end
end
animTable[name] = {}
animTable[name].count = 0
animTable[name].totalWeight = 0
animTable[name].connections = {}
local allowCustomAnimations = true
local AllowDisableCustomAnimsUserFlag = true
local success, msg = pcall(function()
AllowDisableCustomAnimsUserFlag = UserSettings():IsUserFeatureEnabled("UserAllowDisableCustomAnims")
end)
if (AllowDisableCustomAnimsUserFlag) then
local ps = game:GetService("StarterPlayer"):FindFirstChild("PlayerSettings")
if (ps ~= nil) then
allowCustomAnimations = not require(ps).UseDefaultAnimations
end
end
-- check for config values
local config = script:FindFirstChild(name)
if (allowCustomAnimations and config ~= nil) then
table.insert(animTable[name].connections, config.ChildAdded:connect(function(child) configureAnimationSet(name, fileList) end))
table.insert(animTable[name].connections, config.ChildRemoved:connect(function(child) configureAnimationSet(name, fileList) end))
local idx = 1
for _, childPart in pairs(config:GetChildren()) do
if (childPart:IsA("Animation")) then
table.insert(animTable[name].connections, childPart.Changed:connect(function(property) configureAnimationSet(name, fileList) end))
animTable[name][idx] = {}
animTable[name][idx].anim = childPart
local weightObject = childPart:FindFirstChild("Weight")
if (weightObject == nil) then
animTable[name][idx].weight = 1
else
animTable[name][idx].weight = weightObject.Value
end
animTable[name].count = animTable[name].count + 1
animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight
|
--- AS OF NOW THIS ONLY WORKS ON THUNDERBOLTS
|
local hingePos = script.Parent.Hinge.Position
local handle = script.Parent.Handle
local off = false
local setname = "On"
local c1 = script.Parent.Handle.CFrame
local c2 = script.Parent.HandleOff.CFrame
local c3 = script.Parent.HandleOn.CFrame
local dd = false
local ud = false
function down()
dd = true
for i = 0.1,1, 0.01 do
script.Parent.Handle.CFrame = c1:Lerp(c2,i)
wait()
end
dd = false
end
function up()
ud = true
for i = 0.1,1, 0.01 do
script.Parent.Handle.CFrame = script.Parent.Handle.CFrame:Lerp(c3,i)
wait()
end
ud = false
end
handle.ClickDetector.MouseClick:Connect(function()
if off == false then
off = true
if dd == true then
else
down()
end
local n = script.Parent.Parent:FindFirstChild(setname)
assert(n,"Error Finding Name!")
n.Value = false
n.Name = "(Disabled)"
setname = "(Disabled)"
else
off = false
if ud == true then
else
up()
end
local n = script.Parent.Parent:FindFirstChild(setname)
assert(n,"Error Finding Name!")
n.Name = "On"
setname = "On"
end
end)
|
-- Initialize the state of the textBox
|
textBox.Text = ""
|
-- Foots
|
character.LeftFoot.Material = Material
character.RightFoot.Material = Material
|
--[=[
:::warning
This caches the last value seen, and may memory leak.
:::
@param parent Instance
@param className string
@param name string
@return Observable<any>
:::
]=]
-- TODO: Handle default value/nothing there, instead of memory leaking!
|
function RxValueBaseUtils.observe(parent, className, name)
warn("[RxValueBaseUtils.observe] - Deprecated since 4.0.0. Use RxValueBaseUtils.observeBrio")
return RxInstanceUtils.observeLastNamedChildBrio(parent, className, name)
:Pipe({
RxBrioUtils.switchMap(function(valueObject)
return RxValueBaseUtils.observeValue(valueObject)
end)
})
end
|
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare
]]
|
local autoscaling = false --Estimates top speed
local UNITS = { --Click on speed to change units
--First unit is default
{
units = "KMH" ,
scaling = (10/12) * 1.09728 , -- 1 stud : 10 inches | ft/s to MPH
maxSpeed = 220 ,
spInc = 40 , -- Increment between labelled notches
},
{
units = "KMH" ,
scaling = (10/12) * 1.09728 , -- 1 stud : 10 inches | ft/s to KP/H
maxSpeed = 220 ,
spInc = 40 , -- Increment between labelled notches
},
{
units = "KMH" ,
scaling = (10/12) * 1.09728 , -- Roblox standard
maxSpeed = 220 ,
spInc = 40 , -- Increment between labelled notches
}
}
|
-- Function
|
botao.ProximityPrompt.Triggered:Connect(function(plr)
--
if plr.PlayerInfo.Patente.Value >= 3 then
--
if aberto == false then
create1:Play()
som:Play()
script.Parent.Parent.Collider.CanCollide = false
wait(3)
aberto = true
else
create2:Play()
som:Play()
script.Parent.Parent.Collider.CanCollide = true
wait(3)
aberto = false
end
--
else
local Clone = script.NotificationScript:Clone()
Clone.Disabled = false
Clone.Parent = plr.PlayerGui
end
end)
|
--[[
--local scale = hit.Parent.Hair.Handle.Belly.Mesh.Scale.Vector3.x
IN.Belly.Mesh.Scale = Vector3.new(0,0,0)
IN.Belly2.Mesh.Scale = Vector3.new(0,0,0)
IN.Front1.Mesh.Scale = Vector3.new(0,0,0)
IN.Back1.Mesh.Scale = Vector3.new(0,0,0)
IN.Front2.Mesh.Scale = Vector3.new(0,0,0)
IN.Back2.Mesh.Scale = Vector3.new(0,0,0)
wait (1)
]]
|
--
local Inf = 1
for i = 1, (Inf*1) do
--From front: Vector3(+,-(Right,Left)(Up,Down)(Forward,Back))
--Belly rate
local bel = .1
IN.Belly.Mesh.Scale = IN.Belly.Mesh.Scale + Vector3.new(bel,bel,bel)
IN.Belly2.Mesh.Scale = IN.Belly2.Mesh.Scale + Vector3.new(bel,bel,bel)
IN.Belly.Mesh.Offset = IN.Belly.Mesh.Offset + Vector3.new(0, 0,bel/2)
IN.Belly2.Mesh.Offset = IN.Belly2.Mesh.Offset + Vector3.new(0, 0,bel/2)
--Front rate
local boo = .1
IN.Front1.Mesh.Scale = IN.Front1.Mesh.Scale + Vector3.new(boo, boo, boo)
IN.Front11.Mesh.Scale = IN.Front11.Mesh.Scale + Vector3.new(boo, boo, boo)
IN.Front2.Mesh.Scale = IN.Front2.Mesh.Scale + Vector3.new(boo, boo, boo)
IN.Front21.Mesh.Scale = IN.Front21.Mesh.Scale + Vector3.new(boo, boo, boo)
IN.Front1.Mesh.Offset = IN.Front1.Mesh.Offset + Vector3.new(-boo/5, 0, boo/2.5)
IN.Front11.Mesh.Offset = IN.Front11.Mesh.Offset + Vector3.new(-boo/5, 0, boo/2.5)
IN.Front2.Mesh.Offset = IN.Front2.Mesh.Offset + Vector3.new(boo/5, 0, boo/2.5)
IN.Front21.Mesh.Offset = IN.Front21.Mesh.Offset + Vector3.new(boo/5, 0, boo/2.5)
--Back rate
local back = .1
IN.Back1.Mesh.Scale = IN.Back1.Mesh.Scale + Vector3.new(back, back, back)
IN.Back2.Mesh.Scale = IN.Back2.Mesh.Scale + Vector3.new(back, back, back)
IN.Back1.Mesh.Offset = IN.Back1.Mesh.Offset + Vector3.new(-back/5, 0, -back/4)
IN.Back2.Mesh.Offset = IN.Back2.Mesh.Offset + Vector3.new(back/5, 0, -back/4)
--Speed
local spe = .004
hit.Parent.Humanoid.WalkSpeed = (hit.Parent.Humanoid.WalkSpeed - spe)
end
|
--[[Weight and CG]]
|
Tune.Weight = 1120 -- Total weight (in pounds)
Tune.WeightBSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable)
--[[Width]] 6 ,
--[[Height]] 3.5 ,
--[[Length]] 9 }
Tune.WeightDist = 50 -- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100)
Tune.CGHeight = .8 -- Center of gravity height (studs relative to median of all wheels)
Tune.WBVisible = false -- Makes the weight brick visible
--Unsprung Weight
Tune.FWheelDensity = 1.0 -- Front Wheel Density
Tune.RWheelDensity = 1.0 -- Rear Wheel Density
Tune.FWLgcyDensity = 1 -- Front Wheel Density [PGS OFF]
Tune.RWLgcyDensity = 1 -- Rear Wheel Density [PGS OFF]
Tune.AxleSize = 2 -- Size of structural members (larger = more stable/carry more weight)
Tune.AxleDensity = .1 -- Density of structural members
|
--Uberubert
--This script is free to use for anyone
|
local ting = 0 --debouncer
function onTouched(hit)
if ting == 0 then --debounce check
ting = 1 --activate debounce
check = hit.Parent:FindFirstChild("Humanoid") --Find the human that touched the button
if check ~= nil then --If a human is found, then
local user = game.Players:GetPlayerFromCharacter(hit.Parent) --get player from touching human
local stats = user:findFirstChild("leaderstats") --Find moneyholder
if stats ~= nil then --If moneyholder exists then
local cash = stats:findFirstChild("SOULS") --Money type
cash.Value = cash.Value +1000 --increase amount of money by the number displayed here (500)
wait(3) --wait-time before button works again
end
end
ting = 0 --remove debounce
end
end
script.Parent.Touched:connect(onTouched)
|
--local Player
--local Character
--local Humanoid
|
local Module = require(Tool:WaitForChild("Setting"))
local ChangeMagAndAmmo = script:WaitForChild("ChangeMagAndAmmo")
local Grip2
local Handle2
if Module.DualEnabled then
Handle2 = Tool:WaitForChild("Handle2",1)
if Handle2 == nil and Module.DualEnabled then error("\"Dual\" setting is enabled but \"Handle2\" is missing!") end
end
local MagValue = script:FindFirstChild("Mag") or Instance.new("NumberValue",script)
MagValue.Name = "Mag"
MagValue.Value = Module.AmmoPerMag
local AmmoValue = script:FindFirstChild("Ammo") or Instance.new("NumberValue",script)
AmmoValue.Name = "Ammo"
AmmoValue.Value = Module.LimitedAmmoEnabled and Module.Ammo or 0
if Module.IdleAnimationID ~= nil or Module.DualEnabled then
local IdleAnim = Instance.new("Animation",Tool)
IdleAnim.Name = "IdleAnim"
IdleAnim.AnimationId = "rbxassetid://"..(Module.DualEnabled and 53610688 or Module.IdleAnimationID)
end
if Module.FireAnimationID ~= nil then
local FireAnim = Instance.new("Animation",Tool)
FireAnim.Name = "FireAnim"
FireAnim.AnimationId = "rbxassetid://"..Module.FireAnimationID
end
if Module.ReloadAnimationID ~= nil then
local ReloadAnim = Instance.new("Animation",Tool)
ReloadAnim.Name = "ReloadAnim"
ReloadAnim.AnimationId = "rbxassetid://"..Module.ReloadAnimationID
end
if Module.ShotgunClipinAnimationID ~= nil then
local ShotgunClipinAnim = Instance.new("Animation",Tool)
ShotgunClipinAnim.Name = "ShotgunClipinAnim"
ShotgunClipinAnim.AnimationId = "rbxassetid://"..Module.ShotgunClipinAnimationID
end
if Module.ShotgunPumpinAnimationID ~= nil then
local ShotgunPumpinAnim = Instance.new("Animation",Tool)
ShotgunPumpinAnim.Name = "ShotgunPumpinAnim"
ShotgunPumpinAnim.AnimationId = "rbxassetid://"..Module.ShotgunPumpinAnimationID
end
if Module.HoldDownAnimationID ~= nil then
local HoldDownAnim = Instance.new("Animation",Tool)
HoldDownAnim.Name = "HoldDownAnim"
HoldDownAnim.AnimationId = "rbxassetid://"..Module.HoldDownAnimationID
end
if Module.EquippedAnimationID ~= nil then
local EquippedAnim = Instance.new("Animation",Tool)
EquippedAnim.Name = "EquippedAnim"
EquippedAnim.AnimationId = "rbxassetid://"..Module.EquippedAnimationID
end
if Module.SecondaryFireAnimationEnabled and Module.SecondaryFireAnimationID ~= nil then
local SecondaryFireAnim = Instance.new("Animation",Tool)
SecondaryFireAnim.Name = "SecondaryFireAnim"
SecondaryFireAnim.AnimationId = "rbxassetid://"..Module.SecondaryFireAnimationID
end
if Module.SecondaryShotgunPump and Module.SecondaryShotgunPumpinAnimationID ~= nil then
local SecondaryShotgunPumpinAnim = Instance.new("Animation",Tool)
SecondaryShotgunPumpinAnim.Name = "SecondaryShotgunPumpinAnim"
SecondaryShotgunPumpinAnim.AnimationId = "rbxassetid://"..Module.SecondaryShotgunPumpinAnimationID
end
if Module.AimAnimationsEnabled and Module.AimIdleAnimationID ~= nil then
local AimIdleAnim = Instance.new("Animation",Tool)
AimIdleAnim.Name = "AimIdleAnim"
AimIdleAnim.AnimationId = "rbxassetid://"..Module.AimIdleAnimationID
end
if Module.AimAnimationsEnabled and Module.AimFireAnimationID ~= nil then
local AimFireAnim = Instance.new("Animation",Tool)
AimFireAnim.Name = "AimFireAnim"
AimFireAnim.AnimationId = "rbxassetid://"..Module.AimFireAnimationID
end
if Module.AimAnimationsEnabled and Module.AimSecondaryFireAnimationID ~= nil then
local AimSecondaryFireAnim = Instance.new("Animation",Tool)
AimSecondaryFireAnim.Name = "AimSecondaryFireAnim"
AimSecondaryFireAnim.AnimationId = "rbxassetid://"..Module.AimSecondaryFireAnimationID
end
if Module.TacticalReloadAnimationEnabled and Module.TacticalReloadAnimationID ~= nil then
local TacticalReloadAnim = Instance.new("Animation",Tool)
TacticalReloadAnim.Name = "TacticalReloadAnim"
TacticalReloadAnim.AnimationId = "rbxassetid://"..Module.TacticalReloadAnimationID
end
if Module.InspectAnimationEnabled and Module.InspectAnimationID ~= nil then
local InspectAnim = Instance.new("Animation",Tool)
InspectAnim.Name = "InspectAnim"
InspectAnim.AnimationId = "rbxassetid://"..Module.InspectAnimationID
end
|
--[[
OrbitalCamera - Spherical coordinates control camera for top-down games
2018 Camera Update - AllYourBlox
--]]
| |
--[[
Converts a yielding function into a Promise-returning one.
]]
|
function Promise.promisify(callback, selfValue)
return function(...)
local length, values = pack(...)
return Promise.async(function(resolve)
if selfValue == nil then
resolve(callback(unpack(values, 1, length)))
else
resolve(callback(selfValue, unpack(values, 1, length)))
end
end)
end
end
function Promise.prototype:getStatus()
return self._status
end
|
--[=[
@class KnitServer
@server
Knit server-side lets developers create services and expose methods and signals
to the clients.
```lua
local Knit = require(somewhere.Knit)
-- Load service modules within some folder:
Knit.AddServices(somewhere.Services)
-- Start Knit:
Knit.Start():andThen(function()
print("Knit started")
end):catch(warn)
```
]=]
|
local KnitServer = {}
|
--[[Run]]
|
--Print Version
local ver=require(car["A-Chassis Tune"].README)
print("//INSPARE: AC6 Loaded - Build "..ver)
--Runtime Loops
-- ~60 c/s
game["Run Service"].Stepped:connect(function()
--Steering
Steering()
--RPM
RPM()
--Power
Engine()
--Update External Values
_IsOn = script.Parent.IsOn.Value
_InControls = script.Parent.ControlsOpen.Value
script.Parent.Values.Gear.Value = _CGear
script.Parent.Values.RPM.Value = _RPM
script.Parent.Values.Horsepower.Value = _HP
script.Parent.Values.Torque.Value = _HP * _Tune.EqPoint / _RPM
script.Parent.Values.TransmissionMode.Value = _TMode
script.Parent.Values.Throttle.Value = _GThrot
script.Parent.Values.Brake.Value = _GBrake
script.Parent.Values.SteerC.Value = _GSteerC*(1-math.min(car.DriveSeat.Velocity.Magnitude/_Tune.SteerDecay,1-(_Tune.MinSteer/100)))
script.Parent.Values.SteerT.Value = _GSteerT
script.Parent.Values.PBrake.Value = _PBrake
script.Parent.Values.TCS.Value = _TCS
script.Parent.Values.TCSActive.Value = _TCSActive
script.Parent.Values.ABS.Value = _ABS
script.Parent.Values.ABSActive.Value = _ABSActive
script.Parent.Values.MouseSteerOn.Value = _MSteer
script.Parent.Values.Velocity.Value = car.DriveSeat.Velocity
end)
--Bertox part
local UNITS = {{units = "MPH" ,scaling = (10/12) * (60/88) ,maxSpeed = 230,spInc = 20,}}
local busyPart = nil
local busyPart2 = nil
local SpeedDistance = 0
local AEBActive = false
local BSMLeft = false
local BSMRight = false
local AEBBrake = 0
local AEBFull = false
local ACCEnabled = false
local ACCOriginalSpeed = 75
local ACCSpeed = ACCOriginalSpeed
local ACCStop = false
local bsmbusyPart = nil
script.Parent.CruiseControl.Set.MouseButton1Down:Connect(function()
if UNITS[1].scaling*car.DriveSeat.Velocity.Magnitude > 2 then
ACCOriginalSpeed = UNITS[1].scaling*car.DriveSeat.Velocity.Magnitude
ACCEnabled = true
script.Parent.CruiseControl.CruiseSpeed.TextColor3 = Color3.fromRGB(255, 85, 0)
script.Parent.CruiseControl.Return.ImageColor3 = Color3.fromRGB(255, 85, 0)
car.Body.Display.GaugeDisplay.BMWGauges.BMWSystem.SymbolLights.CruiseControl.Visible = true
car.Body.Display.GaugeDisplay.BMWGauges.BMWSystem.SymbolLights.CruiseControl2.Visible = true
script.Parent.CruiseControl.CruiseSpeed.Text = math.floor(ACCOriginalSpeed)
end
end)
script.Parent.CruiseControl.Res.MouseButton1Down:Connect(function()
ACCEnabled = true
script.Parent.CruiseControl.CruiseSpeed.Text = math.floor(ACCOriginalSpeed)
script.Parent.CruiseControl.CruiseSpeed.TextColor3 = Color3.fromRGB(255, 85, 0)
script.Parent.CruiseControl.Return.ImageColor3 = Color3.fromRGB(255, 85, 0)
car.Body.Display.GaugeDisplay.BMWGauges.BMWSystem.SymbolLights.CruiseControl.Visible = true
car.Body.Display.GaugeDisplay.BMWGauges.BMWSystem.SymbolLights.CruiseControl2.Visible = true
end)
script.Parent.CruiseControl.Up.MouseButton1Down:Connect(function()
ACCOriginalSpeed = ACCOriginalSpeed + 1
script.Parent.CruiseControl.CruiseSpeed.Text = math.floor(ACCOriginalSpeed)
end)
script.Parent.CruiseControl.Return.MouseButton1Down:Connect(function()
if ACCEnabled == true then
ACCEnabled = false
_GThrot = 0
script.Parent.CruiseControl.CruiseSpeed.Text = math.floor(ACCOriginalSpeed)
if (ACCStop == true or ACCEasyBrake == true) then
ACCStop = false
ACCEasyBrake = false
_GBrake = 0
end
script.Parent.CruiseControl.CruiseSpeed.TextColor3 = Color3.fromRGB(255,255,255)
script.Parent.CruiseControl.Return.ImageColor3 = Color3.fromRGB(255,255,255)
car.Body.Display.GaugeDisplay.BMWGauges.BMWSystem.SymbolLights.CruiseControl.Visible = false
car.Body.Display.GaugeDisplay.BMWGauges.BMWSystem.SymbolLights.CruiseControl2.Visible = false
else
ACCEnabled = true
script.Parent.CruiseControl.CruiseSpeed.Text = math.floor(ACCOriginalSpeed)
script.Parent.CruiseControl.CruiseSpeed.TextColor3 = Color3.fromRGB(255, 85, 0)
script.Parent.CruiseControl.Return.ImageColor3 = Color3.fromRGB(255, 85, 0)
car.Body.Display.GaugeDisplay.BMWGauges.BMWSystem.SymbolLights.CruiseControl.Visible = true
car.Body.Display.GaugeDisplay.BMWGauges.BMWSystem.SymbolLights.CruiseControl2.Visible = true
end
end)
script.Parent.CruiseControl.Down.MouseButton1Down:Connect(function()
ACCOriginalSpeed = ACCOriginalSpeed - 1
script.Parent.CruiseControl.CruiseSpeed.Text = math.floor(ACCOriginalSpeed)
if ACCOriginalSpeed <= 2 then
ACCEnabled = false
_GThrot = 0
if (ACCStop == true or ACCEasyBrake == true) then
ACCStop = false
ACCEasyBrake = false
_GBrake = 0
end
script.Parent.CruiseControl.CruiseSpeed.TextColor3 = Color3.fromRGB(255,255,255)
script.Parent.CruiseControl.Return.ImageColor3 = Color3.fromRGB(255,255,255)
car.Body.Display.GaugeDisplay.BMWGauges.BMWSystem.SymbolLights.CruiseControl.Visible = false
car.Body.Display.GaugeDisplay.BMWGauges.BMWSystem.SymbolLights.CruiseControl2.Visible = false
end
end)
--Bertox part end
-- ~15 c/s
while wait(.0667) do
--Flip
if _Tune.AutoFlip then Flip() end
--[[Bertox'Scripts begins here]]
--AEB
if _GBrake > 0 and AEBBrake == 0 and ACCStop == false and ACCEasyBrake == false and AEBFull == false and AEBActive == false then
ACCEnabled = false
_GThrot = 0
if ACCStop == true then
ACCStop = false
_GBrake = 0
end
car.Body.Display.GaugeDisplay.BMWGauges.BMWSystem.SymbolLights.CruiseControl.Visible = false
car.Body.Display.GaugeDisplay.BMWGauges.BMWSystem.SymbolLights.CruiseControl2.Visible = false
script.Parent.CruiseControl.CruiseSpeed.TextColor3 = Color3.fromRGB(255,255,255)
script.Parent.CruiseControl.Return.ImageColor3 = Color3.fromRGB(255,255,255)
end
busyPart = nil
busyPart2 = nil
bsmbusyPart = nil
speed = UNITS[1].scaling*car.DriveSeat.Velocity.Magnitude
for i,v in pairs(car.Body.Rays:GetChildren()) do
if speed > 40 then
ray = Ray.new(v.Position, v.CFrame.lookVector*(speed*speed+speed)/50)
elseif speed <= 40 then
ray = Ray.new(v.Position, v.CFrame.lookVector*(speed*speed+speed )/50)
end
local part, endPoint = workspace:FindPartOnRayWithIgnoreList(ray,{car.Body,car.Wheels,car.Misc})
if part then
if part.Anchored == false then
busyPart = part
end
end
end
if busyPart and speed > 3 and (speed < 60 or ACCEnabled == true) and _GSteerT == 0 and _CGear > 0 and car.DriveSeat.Values.AEBisOn.Value == true and car.Electrics.Value == true then
--print("BLOCKING PART: " ,busyPart.Name, " DISTANCE: " , math.floor((busyPart.Position - car.DriveSeat.Position).Magnitude), " CAR SPEED: ", math.floor(speed), " - ", math.floor((busyPart.Position - car.DriveSeat.Position).Magnitude-speed))
_GBrake = 1
car.SafetySystems:FireServer("AEB",true)
_GThrot = 0
AEBActive = true
if ACCEnabled == false then
if AEBBrake == 0 then
script.AssistantAlarm:Play()
car.Body.Display.GaugeDisplay.BMWGauges.BMWSystem.SymbolLights.BRAKE.Visible = true
script.Parent.AC6_Stock_Gauges.EBrake.Visible = true
end
end
AEBBrake = 1
if busyPart.Velocity.Magnitude <= 3 then
AEBFull = true
elseif ACCEnabled == true then
TargetSpeed = UNITS[1].scaling*busyPart.Velocity.Magnitude
ACCSpeed = TargetSpeed
end
elseif AEBActive == true then
AEBActive = false
elseif AEBActive == false and AEBBrake == 1 then
AEBBrake = 2
elseif AEBActive == false and AEBBrake == 2 and AEBFull == false then
AEBBrake = 0
car.SafetySystems:FireServer("AEB",false)
script.Parent.AC6_Stock_Gauges.EBrake.Visible = false
car.Body.Display.GaugeDisplay.BMWGauges.BMWSystem.SymbolLights.BRAKE.Visible = false
_GBrake = 0
elseif AEBFull == true and speed <= 0.1 then
AEBFull = false
_GBrake = 0
elseif ACCEnabled == true then
if speed < ACCSpeed-5 and ACCStop == false and AEBBrake == 0 then
_GThrot = 1
_GBrake = 0
ACCEasyBrake = false
elseif speed < ACCSpeed and ACCStop == false and AEBBrake == 0 then
_GThrot = 0.3
_GBrake = 0
ACCEasyBrake = false
elseif speed > ACCSpeed+5 and ACCStop == false and AEBBrake == 0 then
_GThrot = 0
_GBrake = 1
ACCEasyBrake = true
elseif speed > ACCSpeed+3 and ACCStop == false and AEBBrake == 0 then
_GThrot = 0
_GBrake = 0.4
ACCEasyBrake = true
elseif speed > ACCSpeed+2 and ACCStop == false and AEBBrake == 0 then
_GThrot = 0
_GBrake = 0.1
ACCEasyBrake = true
elseif ACCStop == false and AEBBrake == 0 then
_GThrot = 0.08
_GBrake = 0
ACCEasyBrake = false
end
if AEBBrake == 0 then
if ACCStop == false then
for i,v in pairs(car.Body.Rays:GetChildren()) do
if speed > 40 then
ray = Ray.new(v.Position, v.CFrame.lookVector*(speed*speed+speed)/25)
elseif speed <= 40 then
ray = Ray.new(v.Position, v.CFrame.lookVector*(speed*speed+speed )/10)
end
local part, endPoint = workspace:FindPartOnRayWithIgnoreList(ray,{car.Body,car.Wheels,car.Misc})
if part then
if part.Anchored == false then
busyPart2 = part
end
end
end
else
for i,v in pairs(car.Body.Rays:GetChildren()) do
ray = Ray.new(v.Position, v.CFrame.lookVector*20)
local part, endPoint = workspace:FindPartOnRayWithIgnoreList(ray,{car.Body,car.Wheels,car.Misc})
if part then
if part.Anchored == false then
busyPart2 = part
end
end
end
end
if busyPart2 == nil then
ACCSpeed = ACCOriginalSpeed
if ACCEasyBrake == false then
_GBrake = 0
end
ACCStop = false
elseif busyPart2.Velocity.Magnitude < 3 then
ACCStop = true
_GThrot = 0
_GBrake = 1
ACCSpeed = UNITS[1].scaling*busyPart2.Velocity.Magnitude
else
ACCStop = false
ACCSpeed = UNITS[1].scaling*busyPart2.Velocity.Magnitude
end
end
end
BSMLeft = false
BSMRight = false
for i,v in pairs(car.Body.BSM:GetChildren()) do
ray = Ray.new(v.Position, v.CFrame.lookVector*25)
local part, endPoint = workspace:FindPartOnRayWithIgnoreList(ray,{car.Body,car.Wheels,car.Misc})
if part then
if part.Anchored == false then
bsmbusyPart = part
if v.Name:sub(1,1) == "L" then
BSMLeft = true
else
BSMRight = true
end
end
end
end
car.SafetySystems:FireServer("BSM",BSMLeft,BSMRight)
--[[Bertox'Scripts ends here]]
end
|
-- Decompiled with the Synapse X Luau decompiler.
|
local v1, v2 = pcall(function()
return UserSettings():IsUserFeatureEnabled("UserRemoveMessageOnTextFilterFailures");
end);
local v3 = {
ScrollBarThickness = 4
};
local l__Parent__4 = script.Parent;
local v5 = {};
v5.__index = v5;
local u1 = require(game:GetService("Chat"):WaitForChild("ClientChatModules"):WaitForChild("ChatSettings"));
function v5.Destroy(p1)
p1.GuiObject:Destroy();
p1.Destroyed = true;
end;
function v5.SetActive(p2, p3)
p2.GuiObject.Visible = p3;
end;
local u2 = v1 or v2;
function v5.UpdateMessageFiltered(p4, p5)
local v6 = nil;
local v7 = 1;
local l__MessageObjectLog__8 = p4.MessageObjectLog;
while v7 <= #l__MessageObjectLog__8 do
local v9 = l__MessageObjectLog__8[v7];
if v9.ID == p5.ID then
v6 = v9;
break;
end;
v7 = v7 + 1;
end;
if v6 then
if not u2 then
v6.UpdateTextFunction(p5);
p4:PositionMessageLabelInWindow(v6, v7);
return;
end;
else
return;
end;
if p5.Message == "" then
p4:RemoveMessageAtIndex(v7);
return;
end;
v6.UpdateTextFunction(p5);
p4:PositionMessageLabelInWindow(v6, v7);
end;
local u3 = require(l__Parent__4:WaitForChild("MessageLabelCreator")).new();
function v5.AddMessage(p6, p7)
p6:WaitUntilParentedCorrectly();
local v10 = u3:CreateMessageLabel(p7, p6.CurrentChannelName);
if v10 == nil then
return;
end;
table.insert(p6.MessageObjectLog, v10);
p6:PositionMessageLabelInWindow(v10, #p6.MessageObjectLog);
end;
function v5.RemoveMessageAtIndex(p8, p9)
p8:WaitUntilParentedCorrectly();
local v11 = p8.MessageObjectLog[p9];
if v11 then
v11:Destroy();
table.remove(p8.MessageObjectLog, p9);
end;
end;
function v5.AddMessageAtIndex(p10, p11, p12)
local v12 = u3:CreateMessageLabel(p11, p10.CurrentChannelName);
if v12 == nil then
return;
end;
table.insert(p10.MessageObjectLog, p12, v12);
p10:PositionMessageLabelInWindow(v12, p12);
end;
function v5.RemoveLastMessage(p13)
p13:WaitUntilParentedCorrectly();
p13.MessageObjectLog[1]:Destroy();
table.remove(p13.MessageObjectLog, 1);
end;
function v5.IsScrolledDown(p14)
local l__Offset__13 = p14.Scroller.CanvasSize.Y.Offset;
local l__Y__14 = p14.Scroller.AbsoluteWindowSize.Y;
local v15 = true;
if not (l__Offset__13 < l__Y__14) then
v15 = l__Offset__13 - p14.Scroller.CanvasPosition.Y <= l__Y__14 + 5;
end;
return v15;
end;
function v5.UpdateMessageTextHeight(p15, p16)
local l__BaseFrame__16 = p16.BaseFrame;
for v17 = 1, 10 do
if p16.BaseMessage.TextFits then
break;
end;
l__BaseFrame__16.Size = UDim2.new(1, 0, 0, p16.GetHeightFunction(p15.Scroller.AbsoluteSize.X - v17));
end;
end;
function v5.PositionMessageLabelInWindow(p17, p18, p19)
p17:WaitUntilParentedCorrectly();
local l__BaseFrame__18 = p18.BaseFrame;
local v19 = 1;
if p17.MessageObjectLog[p19 - 1] then
if p19 == #p17.MessageObjectLog then
v19 = p17.MessageObjectLog[p19 - 1].BaseFrame.LayoutOrder + 1;
else
v19 = p17.MessageObjectLog[p19 - 1].BaseFrame.LayoutOrder;
end;
end;
l__BaseFrame__18.LayoutOrder = v19;
l__BaseFrame__18.Size = UDim2.new(1, 0, 0, p18.GetHeightFunction(p17.Scroller.AbsoluteSize.X));
l__BaseFrame__18.Parent = p17.Scroller;
if p18.BaseMessage then
p17:UpdateMessageTextHeight(p18);
end;
if p17:IsScrolledDown() then
p17.Scroller.CanvasPosition = Vector2.new(0, math.max(0, p17.Scroller.CanvasSize.Y.Offset - p17.Scroller.AbsoluteSize.Y));
end;
end;
function v5.ReorderAllMessages(p20)
p20:WaitUntilParentedCorrectly();
if p20.GuiObject.AbsoluteSize.Y < 1 then
return;
end;
for v20, v21 in pairs(p20.MessageObjectLog) do
p20:UpdateMessageTextHeight(v21);
end;
if not p20:IsScrolledDown() then
p20.Scroller.CanvasPosition = p20.Scroller.CanvasPosition;
return;
end;
p20.Scroller.CanvasPosition = Vector2.new(0, math.max(0, p20.Scroller.CanvasSize.Y.Offset - p20.Scroller.AbsoluteSize.Y));
end;
function v5.Clear(p21)
for v22, v23 in pairs(p21.MessageObjectLog) do
v23:Destroy();
end;
p21.MessageObjectLog = {};
end;
function v5.SetCurrentChannelName(p22, p23)
p22.CurrentChannelName = p23;
end;
function v5.FadeOutBackground(p24, p25)
end;
function v5.FadeInBackground(p26, p27)
end;
local u4 = require(l__Parent__4:WaitForChild("CurveUtil"));
function v5.FadeOutText(p28, p29)
for v24 = 1, #p28.MessageObjectLog do
if p28.MessageObjectLog[v24].FadeOutFunction then
p28.MessageObjectLog[v24].FadeOutFunction(p29, u4);
end;
end;
end;
function v5.FadeInText(p30, p31)
for v25 = 1, #p30.MessageObjectLog do
if p30.MessageObjectLog[v25].FadeInFunction then
p30.MessageObjectLog[v25].FadeInFunction(p31, u4);
end;
end;
end;
function v5.Update(p32, p33)
for v26 = 1, #p32.MessageObjectLog do
if p32.MessageObjectLog[v26].UpdateAnimFunction then
p32.MessageObjectLog[v26].UpdateAnimFunction(p33, u4);
end;
end;
end;
function v5.WaitUntilParentedCorrectly(p34)
while not p34.GuiObject:IsDescendantOf(game:GetService("Players").LocalPlayer) do
p34.GuiObject.AncestryChanged:wait();
end;
end;
local function u5()
local v27 = Instance.new("Frame");
v27.Selectable = false;
v27.Size = UDim2.new(1, 0, 1, 0);
v27.BackgroundTransparency = 1;
local v28 = Instance.new("ScrollingFrame");
v28.Selectable = u1.GamepadNavigationEnabled;
v28.Name = "Scroller";
v28.BackgroundTransparency = 1;
v28.BorderSizePixel = 0;
v28.Position = UDim2.new(0, 0, 0, 3);
v28.Size = UDim2.new(1, -4, 1, -6);
v28.CanvasSize = UDim2.new(0, 0, 0, 0);
v28.ScrollBarThickness = v3.ScrollBarThickness;
v28.Active = true;
v28.Parent = v27;
local v29 = Instance.new("UIListLayout");
v29.SortOrder = Enum.SortOrder.LayoutOrder;
v29.Parent = v28;
return v27, v28, v29;
end;
function v3.new()
local v30 = setmetatable({}, v5);
v30.Destroyed = false;
local v31, v32, v33 = u5();
v30.GuiObject = v31;
v30.Scroller = v32;
v30.Layout = v33;
v30.MessageObjectLog = {};
v30.Name = "MessageLogDisplay";
v30.GuiObject.Name = "Frame_" .. v30.Name;
v30.CurrentChannelName = "";
v30.GuiObject:GetPropertyChangedSignal("AbsoluteSize"):Connect(function()
spawn(function()
v30:ReorderAllMessages();
end);
end);
local u6 = true;
v30.Layout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(function()
local l__AbsoluteContentSize__34 = v30.Layout.AbsoluteContentSize;
v30.Scroller.CanvasSize = UDim2.new(0, 0, 0, l__AbsoluteContentSize__34.Y);
if u6 then
v30.Scroller.CanvasPosition = Vector2.new(0, l__AbsoluteContentSize__34.Y - v30.Scroller.AbsoluteWindowSize.Y);
end;
end);
v30.Scroller:GetPropertyChangedSignal("CanvasPosition"):Connect(function()
u6 = v30:IsScrolledDown();
end);
return v30;
end;
return v3;
|
------ Script: ------
|
Button.MouseEnter:Connect(function()
GuiSounds.Mouse_Hover:Play()
end)
Button.MouseButton1Down:Connect(function()
GuiSounds.Mouse_ClickedIn:Play()
end)
Button.MouseButton1Up:Connect(function()
GuiSounds.Mouse_ClickedOut:Play()
end)
|
--Functions--
|
UIS.InputBegan:Connect(function(input, isTyping)
if isTyping then return end
if input.KeyCode == Enum.KeyCode.X and Debounce == 1 and Enabled == true and Tool.Equip.Value == true and Tool.Active.Value == "None" then
ButtonDown = true
Debounce = 2
local properties = {FieldOfView = 50}
local info1 = TweenInfo.new(0.2,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,0.1)
local tween = ts:Create(game.Workspace.CurrentCamera,info1,properties)
tween:Play()
local ChargeEffect = script.Charge.Particles.Charge1:Clone()
local Character = Player.Character
ChargeEffect.Parent = Character.HumanoidRootPart
ChargeEffect:Emit(25)
game.Debris:AddItem(ChargeEffect,2)
local StartSfx = game.ReplicatedStorage["Water Wheel"].Sounds.SwordSFX:Clone() -- Sound Effect
StartSfx.Parent = Player.Character.HumanoidRootPart
StartSfx.MaxDistance = 150
StartSfx.TimePosition = 0
StartSfx:Play()
Player.Character.Humanoid.WalkSpeed = 5
Player.Character.Humanoid.JumpPower = 0
local CameraShaker = require(game.ReplicatedStorage["Water Wheel"].Modules.CameraShaker)
local camshake = CameraShaker.new(Enum.RenderPriority.Camera.Value,function(shakeCFrame)
camera.CFrame = camera.CFrame * shakeCFrame
end)
camshake:Start()
camshake:Shake(CameraShaker.Presets.OldBump)
script.Wheel:FireServer("Water Wheel", mouse.Hit.Position)
ButtonDown = true
local properties = {FieldOfView = 85}
local info2 = TweenInfo.new(0.25,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,0.1)
local tween2 = ts:Create(game.Workspace.CurrentCamera,info2,properties)
tween2:Play()
Player.Character.Humanoid.WalkSpeed = 0
Player.Character.Humanoid.JumpPower = 0
task.wait(0.5)
local BV = Instance.new("BodyVelocity")
BV.MaxForce = Vector3.new(300000,0,300000)
BV.Parent = c.HumanoidRootPart
while ButtonDown == true and Player.Character.HumanoidRootPart.Anchored ~= true do
c.HumanoidRootPart.CFrame = CFrame.new(c.HumanoidRootPart.Position, Vector3.new(mouse.Hit.Position.X,c.HumanoidRootPart.Position.Y,mouse.Hit.Position.Z))
BV.Velocity = c.HumanoidRootPart.CFrame.lookVector * 80
RS.Heartbeat:Wait()
end
Enabled = true
BV:Destroy()
end
end)
UIS.InputEnded:Connect(function(input, IsTyping)
if IsTyping then return end
if input.KeyCode == Enum.KeyCode.X and Tool.Equip.Value == true and Tool.Active.Value == "None" and Debounce == 2 and ButtonDown == true then
Debounce = 3
script.Wheel:FireServer("Stop", mouse.Hit.Position)
local properties = {FieldOfView = 70}
local info3 = TweenInfo.new(0.25,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,0.1)
local tween3 = ts:Create(game.Workspace.CurrentCamera,info3,properties)
tween3:Play()
local CameraShaker = require(game.ReplicatedStorage["Water Wheel"].Modules.CameraShaker)
local camshake = CameraShaker.new(Enum.RenderPriority.Camera.Value,function(shakeCFrame)
camera.CFrame = camera.CFrame * shakeCFrame
end)
camshake:Start()
camshake:Shake(CameraShaker.Presets.OldBump)
ButtonDown = false
Key = nil
wait(0.7)
Tool.Active.Value = "None"
Player.Character.Humanoid.WalkSpeed = 16
Player.Character.Humanoid.JumpPower = 50
wait(cooldown)
Debounce = 1
end
end)
|
---
|
local Paint = false
script.Parent.MouseButton1Click:connect(function()
Paint = not Paint
handler:FireServer("Salmon",Paint)
end)
|
---------------------------------------------------------------------
|
local RoundTitle = {}
RoundTitle.__index = RoundTitle
function RoundTitle.new( holder: TextLabel ): ( {} )
local self = setmetatable( {}, RoundTitle )
self._janitor = Janitor.new()
local function OnModeChanged(): ()
holder.Text = workspace:GetAttribute("Mode")
end
workspace:GetAttributeChangedSignal("Mode"):Connect( OnModeChanged )
OnModeChanged()
return self
end
function RoundTitle:Destroy(): ()
self._janitor:Destroy()
end
return RoundTitle
|
--Weld stuff here
|
MakeWeld(car.Misc.Wheel.A,car.DriveSeat,"Motor",.2).Name="W"
ModelWeld(car.Misc.Wheel.Parts,car.Misc.Wheel.A)
MakeWeld(car.DriveSeat,misc:WaitForChild('Downforce'))
misc:WaitForChild("Spoiler")
MakeWeld(car.DriveSeat,misc.Spoiler:WaitForChild("A1")).Name="W"
MakeWeld(misc.Spoiler.A1,misc.Spoiler:WaitForChild("A2"),"Motor",.01).Name="W"
MakeWeld(misc.Spoiler.A2,misc.Spoiler:WaitForChild("A3"),"Motor",.02).Name="W"
MakeWeld(misc.Spoiler.A3,misc.Spoiler:WaitForChild("A"),"Motor",.01).Name="W"
MakeWeld(misc.Spoiler.A3,misc.Spoiler:WaitForChild("A4"),"Motor",.01).Name="P"
MakeWeld(misc.Spoiler.A4,misc.Spoiler:WaitForChild("Sp"),"Motor",.01).Name="W"
MakeWeld(misc.Spoiler.Sp,misc.Spoiler:WaitForChild("B1"))
MakeWeld(misc.Spoiler.B1,misc.Spoiler:WaitForChild("B"),"Motor",.01).Name="W"
car.DriveSeat.ChildAdded:connect(function(child)
if child.Name=="SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
child.C0=CFrame.new(0,-.5,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0)*CFrame.Angles(math.rad(13),0,0)
end
end)
|
-- Thanks for SonicUnleashedXY & Manofthelol for this script.
-- To remove the orginial script just go into shooter & right at the bottem you will see something like this:
-- script.Parent.Tool.Name = ""..script.Parent.Ammo.Value.."|"..script.Parent.StoredAmmo.Value..""
-- Remove only that & add this to the tool.
-- Remember this was designed for Manofthelol weapons so any other weapons might not work.
-- You have no permission to repubish this in you model even if it edited.
-- If your found then you will be ban from my place.
|
local Tool = script.Parent
local Ammo = Tool.Ammo
local MaxAmmo = Ammo.Value
local vPlayer
local Gui
local Text
function onChanged(value)
if value == "Value" or value == Ammo.Value then
if Gui ~= nil and Text ~= nil then
if Ammo.Value >= 1 then
Text.Text = ""..script.Parent.Ammo.Value.."|"..script.Parent.StoredAmmo.Value..""
elseif math.floor(Ammo.Value) == 0 then
Text.Text = ""..script.Parent.Ammo.Value.."|"..script.Parent.StoredAmmo.Value..""
elseif Ammo.Value < 0 then
for i = 0, 1, 0.03 / 2 do
local Num = math.floor(i * MaxAmmo + 0.5)
Text.Text = ""..script.Parent.Ammo.Value.."|"..script.Parent.StoredAmmo.Value..""
wait()
end
end
end
end
end
function on2Changed()
if Gui ~= nil and Text ~= nil then
Text.Text = ""..script.Parent.Ammo.Value.."|"..script.Parent.StoredAmmo.Value..""
wait()
end
end
function setUpGui()
if vPlayer == nil or vPlayer:findFirstChild("PlayerGui") == nil then
return
end
Gui = Instance.new("ScreenGui")
Text = Instance.new("TextLabel")
Gui.Name = "DEDisplay"
Gui.Parent = vPlayer.PlayerGui
Text.BackgroundColor3 = BrickColor.Black().Color
Text.BackgroundTransparency = 1
Text.BorderColor3 = BrickColor.White().Color
Text.BorderSizePixel = 0
Text.Name = "Ammo"
Text.Parent = Gui
Text.Position = UDim2.new(0.85, 0, 0.825, 0)
Text.Size = UDim2.new(0, 128, 0, 64)
Text.FontSize = "Size18"
Text.Text = ""..script.Parent.Ammo.Value.."|"..script.Parent.StoredAmmo.Value..""
Text.TextColor3 = BrickColor.White().Color
end
function onEquippedLocal(mouse)
vPlayer = game.Players.LocalPlayer
setUpGui()
end
function onUnequippedLocal(mouse)
if Gui then
Gui:remove()
end
Gui = nil
Text = nil
vPlayer = nil
end
Tool.Equipped:connect(onEquippedLocal)
Tool.Unequipped:connect(onUnequippedLocal)
Ammo.Changed:connect(onChanged)
Tool.StoredAmmo.Changed:connect(on2Changed)
|
--[[
A helper function to define a Rodux action creator with an associated name.
Normally when creating a Rodux action, you can just create a function:
return function(value)
return {
type = "MyAction",
value = value,
}
end
And then when you check for it in your reducer, you either use a constant,
or type out the string name:
if action.type == "MyAction" then
-- change some state
end
Typos here are a remarkably common bug. We also have the issue that there's
no link between reducers and the actions that they respond to!
`Action` (this helper) provides a utility that makes this a bit cleaner.
Instead, define your Rodux action like this:
return Action("MyAction", function(value)
return {
value = value,
}
end)
We no longer need to add the `type` field manually.
Additionally, the returned action creator now has a 'name' property that can
be checked by your reducer:
local MyAction = require(Reducers.MyAction)
...
if action.type == MyAction.name then
-- change some state!
end
Now we have a clear link between our reducers and the actions they use, and
if we ever typo a name, we'll get a warning in LuaCheck as well as an error
at runtime!
]]
|
return function(name, fn)
assert(type(name) == "string", "A name must be provided to create an Action")
assert(type(fn) == "function", "A function must be provided to create an Action")
return setmetatable({
name = name,
}, {
__call = function(self, ...)
local result = fn(...)
assert(type(result) == "table", "An action must return a table")
result.type = name
return result
end
})
end
|
--[[
Create a new test node. A pointer to the test plan, a phrase to describe it
and the type of node it is are required. The modifier is optional and will
be None if left blank.
]]
|
function TestNode.new(plan, phrase, nodeType, nodeModifier)
nodeModifier = nodeModifier or TestEnum.NodeModifier.None
local node = {
plan = plan,
phrase = phrase,
type = nodeType,
modifier = nodeModifier,
children = {},
callback = nil,
parent = nil,
}
node.environment = newEnvironment(node, plan.extraEnvironment)
return setmetatable(node, TestNode)
end
local function getModifier(name, pattern, modifier)
if pattern and (modifier == nil or modifier == TestEnum.NodeModifier.None) then
if name:match(pattern) then
return TestEnum.NodeModifier.Focus
else
return TestEnum.NodeModifier.Skip
end
end
return modifier
end
function TestNode:addChild(phrase, nodeType, nodeModifier)
if nodeType == TestEnum.NodeType.It then
for _, child in pairs(self.children) do
if child.phrase == phrase then
error("Duplicate it block found: " .. child:getFullName())
end
end
end
local childName = self:getFullName() .. " " .. phrase
nodeModifier = getModifier(childName, self.plan.testNamePattern, nodeModifier)
local child = TestNode.new(self.plan, phrase, nodeType, nodeModifier)
child.parent = self
table.insert(self.children, child)
return child
end
|
---------------
-- Variables --
---------------
|
local RunService = game:GetService('RunService')
local PlayersService = game:GetService('Players')
local Player = PlayersService.LocalPlayer
local Camera = nil
local Character = nil
local HumanoidRootPart = nil
local TorsoPart = nil
local HeadPart = nil
local Mode = nil
local BehaviorFunction = nil
local childAddedConn = nil
local childRemovedConn = nil
local Behaviors = {} -- Map of modes to behavior fns
local SavedHits = {} -- Objects currently being faded in/out
local TrackedLimbs = {} -- Used in limb-tracking casting modes
|
-- This is basically a function that finds all unanchored parts and adds them to childList.
-- Note: This should only be run once for each object
|
function checkObject(obj)
if (obj ~= hole) and (obj.className == "Part") then
if (obj.Anchored == false) then
table.insert(childList, 1, obj)
end
elseif (obj.className == "Model") or (obj.className == "Hat") or (obj.className == "Tool") or (obj == workspace) then
local child = obj:GetChildren()
for x = 1, #child do
checkObject(child[x])
end
obj.ChildAdded:connect(checkObject)
end
end
checkObject(workspace)
print("Black Hole script loaded.")
local n = 0
while true do
if n < #childList then
n = n + 1
if n % 800 == 0 then
wait()
end
else
n = 1
wait()
end
local child = childList[n]
if (child ~= hole) and (child ~= script.Parent.Parent.Tornado) and (child.className == "Part") and (child.Anchored == false) then
local relPos = hole.Position - child.Position
local motivator = child:FindFirstChild("BlackHole Influence")
if relPos.magnitude * 500 * massConstant < mass then
child:BreakJoints()
if (relPos.magnitude * 320 * massConstant < mass) and (child.Size.z + hole.Size.x > relPos.magnitude * 2 - 4) then
mass = mass + child:GetMass()
table.remove(childList, n)
n = n - 1 -- This is the reason I need a counter of my own design
else
child.CanCollide = false -- I Can assume that things won't escape the black hole.
if motivator == nil then
cleanupScript:clone().Parent = child
motivator = Instance.new("BodyPosition")
motivator.Parent = child
motivator.Name = "BlackHole Influence"
end
motivator.position = hole.Position
motivator.maxForce = Vector3.new(1, 1, 1) * mass * child:GetMass() / (relPos.magnitude * massConstant)
end
elseif motivator ~= nil then
motivator:Remove()
end
end
end
|
-- Constructor.
|
function FastCast.new()
return setmetatable({
LengthChanged = Signal.new("LengthChanged"),
RayHit = Signal.new("RayHit"),
RayPierced = Signal.new("RayPierced"),
CastTerminating = Signal.new("CastTerminating"),
WorldRoot = workspace
}, FastCast)
end
|
-- Methods and events to expose from the Dev Module.
|
local module = {
-- Functions
configure = config.configure,
setTriggerWordsForChatAnimation = ChatEmotes.setTriggerWordsForChatAnimation,
-- Events
onChatAnimationPlayed = events.onChatAnimationPlayed.Event,
}
return module
|
-- When supplied, legacyCameraType is used and cameraMovementMode is ignored (should be nil anyways)
-- Next, if userCameraCreator is passed in, that is used as the cameraCreator
|
function CameraModule:ActivateCameraController(cameraMovementMode, legacyCameraType: Enum.CameraType?)
local newCameraCreator = nil
if legacyCameraType~=nil then
--[[
This function has been passed a CameraType enum value. Some of these map to the use of
the LegacyCamera module, the value "Custom" will be translated to a movementMode enum
value based on Dev and User settings, and "Scriptable" will disable the camera controller.
--]]
if legacyCameraType == Enum.CameraType.Scriptable then
if self.activeCameraController then
self.activeCameraController:Enable(false)
self.activeCameraController = nil
end
return
elseif legacyCameraType == Enum.CameraType.Custom then
cameraMovementMode = self:GetCameraMovementModeFromSettings()
elseif legacyCameraType == Enum.CameraType.Track then
-- Note: The TrackCamera module was basically an older, less fully-featured
-- version of ClassicCamera, no longer actively maintained, but it is re-implemented in
-- case a game was dependent on its lack of ClassicCamera's extra functionality.
cameraMovementMode = Enum.ComputerCameraMovementMode.Classic
elseif legacyCameraType == Enum.CameraType.Follow then
cameraMovementMode = Enum.ComputerCameraMovementMode.Follow
elseif legacyCameraType == Enum.CameraType.Orbital then
cameraMovementMode = Enum.ComputerCameraMovementMode.Orbital
elseif legacyCameraType == Enum.CameraType.Attach or
legacyCameraType == Enum.CameraType.Watch or
legacyCameraType == Enum.CameraType.Fixed then
newCameraCreator = LegacyCamera
else
warn("CameraScript encountered an unhandled Camera.CameraType value: ",legacyCameraType)
end
end
if not newCameraCreator then
if FFlagUserFlagEnableNewVRSystem and VRService.VREnabled then
newCameraCreator = VRCamera
elseif cameraMovementMode == Enum.ComputerCameraMovementMode.Classic or
cameraMovementMode == Enum.ComputerCameraMovementMode.Follow or
cameraMovementMode == Enum.ComputerCameraMovementMode.Default or
cameraMovementMode == Enum.ComputerCameraMovementMode.CameraToggle then
newCameraCreator = ClassicCamera
elseif cameraMovementMode == Enum.ComputerCameraMovementMode.Orbital then
newCameraCreator = OrbitalCamera
else
warn("ActivateCameraController did not select a module.")
return
end
end
local isVehicleCamera = self:ShouldUseVehicleCamera()
if isVehicleCamera then
if FFlagUserFlagEnableNewVRSystem and VRService.VREnabled then
newCameraCreator = VRVehicleCamera
else
newCameraCreator = VehicleCamera
end
end
-- Create the camera control module we need if it does not already exist in instantiatedCameraControllers
local newCameraController
if not instantiatedCameraControllers[newCameraCreator] then
newCameraController = newCameraCreator.new()
instantiatedCameraControllers[newCameraCreator] = newCameraController
else
newCameraController = instantiatedCameraControllers[newCameraCreator]
if newCameraController.Reset then
newCameraController:Reset()
end
end
if self.activeCameraController then
-- deactivate the old controller and activate the new one
if self.activeCameraController ~= newCameraController then
self.activeCameraController:Enable(false)
self.activeCameraController = newCameraController
self.activeCameraController:Enable(true)
elseif not self.activeCameraController:GetEnabled() then
self.activeCameraController:Enable(true)
end
elseif newCameraController ~= nil then
-- only activate the new controller
self.activeCameraController = newCameraController
self.activeCameraController:Enable(true)
end
if self.activeCameraController then
if cameraMovementMode~=nil then
self.activeCameraController:SetCameraMovementMode(cameraMovementMode)
elseif legacyCameraType~=nil then
-- Note that this is only called when legacyCameraType is not a type that
-- was convertible to a ComputerCameraMovementMode value, i.e. really only applies to LegacyCamera
self.activeCameraController:SetCameraType(legacyCameraType)
end
end
end
|
------------------------------------------------------------------------------
--------------------[ MAIN PROGRAM ]------------------------------------------
------------------------------------------------------------------------------
|
local Touched = false
Main.Touched:connect(function(Obj)
if IsIgnored(Obj) or Touched then return end
Touched = true
local W = Instance.new("Weld")
W.Name = "Sticky"
W.Part0 = Main
W.Part1 = Obj
W.C0 = Main.CFrame:toObjectSpace(Obj.CFrame)
W.Parent = Main
Main.ChildRemoved:connect(function(C)
if C.Name == "Sticky" then
local W = Instance.new("Weld")
W.Name = "Sticky"
W.Part0 = Main
W.Part1 = Obj
W.C0 = Main.CFrame:toObjectSpace(Obj.CFrame)
W.Parent = Main
end
end)
if Obj then
if Obj.Parent.ClassName == "Hat" then
local HitHumanoid = FindFirstClass(Obj.Parent.Parent, "Humanoid")
if HitHumanoid and IsEnemy(HitHumanoid) then
local CreatorTag = Instance.new("ObjectValue")
CreatorTag.Name = "creator"
CreatorTag.Value = Plyr
CreatorTag.Parent = HitHumanoid
HitHumanoid:TakeDamage(HitHumanoid.MaxHealth)
MarkHit()
end
else
local HitHumanoid = FindFirstClass(Obj.Parent, "Humanoid")
if HitHumanoid and IsEnemy(HitHumanoid) then
local CreatorTag = Instance.new("ObjectValue")
CreatorTag.Name = "creator"
CreatorTag.Value = Plyr
CreatorTag.Parent = HitHumanoid
HitHumanoid:TakeDamage(HitHumanoid.MaxHealth)
MarkHit()
end
end
end
wait(3)
Main.Parent:Destroy()
end)
|
--[[
Utility function to log a Fusion-specific error, without halting execution.
]]
|
local Package = script.Parent.Parent
local Types = require(Package.Types)
local messages = require(Package.Logging.messages)
local function logErrorNonFatal(messageID: string, errObj: Types.Error?, ...)
local formatString: string
if messages[messageID] then
formatString = messages[messageID]
else
messageID = "unknownMessage"
formatString = "Unknown error: ERROR_MESSAGE"
end
local errorString
if errObj == nil then
errorString = string.format("[Fusion] " .. formatString .. "\n(ID: " .. messageID .. ")", ...)
else
formatString = formatString:gsub("ERROR_MESSAGE", errObj.message)
errorString = string.format("[Fusion] " .. formatString .. "\n(ID: " .. messageID .. ")\n---- Stack trace ----\n" .. errObj.trace, ...)
end
task.spawn(function(...)
error(errorString:gsub("\n", "\n "), 0)
end, ...)
end
return logErrorNonFatal
|
-- counts how many sets are currently stored in `initialisedStack`, whether
-- they're currently in use or not
|
local initialisedStackCapacity = 0
local function captureDependencies(saveToSet: Types.Set<Types.Dependency<any>>, callback: (any) -> any, ...): (boolean, any)
-- store whichever set was being saved to previously, and replace it with
-- the new set which was passed in
local prevDependencySet = sharedState.dependencySet
sharedState.dependencySet = saveToSet
-- Add a new 'initialised' set to the stack of initialised sets.
-- If a dependency is created inside the callback (even if indirectly inside
-- a different `captureDependencies` call), it'll be added to this set.
-- This can be used to ignore dependencies that were created inside of the
-- callback.
sharedState.initialisedStackSize += 1
local initialisedStackSize = sharedState.initialisedStackSize
local initialisedSet
-- instead of constructing new sets all of the time, we can simply leave old
-- sets in the stack and keep track of the 'real' number of sets ourselves.
-- this means we don't have to keep creating and throwing away tables, which
-- is great for performance at the expense of slightly more memory usage.
if initialisedStackSize > initialisedStackCapacity then
-- the stack has grown beyond any previous size, so we need to create
-- a new table
initialisedSet = {}
initialisedStack[initialisedStackSize] = initialisedSet
initialisedStackCapacity = initialisedStackSize
else
-- the stack is smaller or equal to some previous size, so we just need
-- to clear whatever set was here before
initialisedSet = initialisedStack[initialisedStackSize]
table.clear(initialisedSet)
end
-- now that the shared state has been set up, call the callback in a pcall.
-- using a pcall means the shared state can be reset afterwards, even if an
-- error occurs.
local ok, value = xpcall(callback, parseError, ...)
-- restore the previous set being saved to
sharedState.dependencySet = prevDependencySet
-- shrink the stack of initialised sets (essentially removing this set)
sharedState.initialisedStackSize -= 1
return ok, value
end
return captureDependencies
|
--------
|
SYNC_RATE:Connect(function()
for Index, Object in ipairs(ActiveHitboxes) do
if Object.deleted then
Handler:remove(Object.object)
else
for _, Point in ipairs(Object.points) do
if not Object.active then
Point.LastPosition = nil
else
local rayStart, rayDir, RelativePointToWorld = Point.solver:solve(Point, game:GetService("ReplicatedStorage"):WaitForChild("ClientSettings").Debug.Value)
local raycastResult = workspace:Raycast(rayStart, rayDir, Object.raycastParams)
Point.solver:lastPosition(Point, RelativePointToWorld)
if raycastResult then
local hitPart = raycastResult.Instance
local findModel = not Object.partMode and hitPart:FindFirstAncestorOfClass("Model")
local humanoid = findModel and findModel:FindFirstChildOfClass("Humanoid")
local target = humanoid or (Object.partMode and hitPart)
if target and not Object.targetsHit[target] then
Object.targetsHit[target] = true
Object.OnHit:Fire(hitPart, humanoid, raycastResult, Point.group)
end
end
if Object.endTime > 0 then
if Object.endTime <= clock() then
Object.endTime = 0
Object:HitStop()
end
end
Object.OnUpdate:Fire(Point.LastPosition)
end
end
end
end
end)
return Handler
|
-- Robase?
|
return function(centiseconds)
local minutes = string.format("%02.f", math.floor(centiseconds / 6000))
local seconds = string.format("%02.f", math.floor((centiseconds - (minutes * 6000)) / 100))
centiseconds = string.format("%02.f", math.floor(centiseconds - (minutes * 6000) - (seconds * 100)))
return minutes .. ":" .. seconds .. "." .. centiseconds
end
|
--[[
Put this inside a LocalScript in a TextButton - For closing
--]]
|
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Visible = false
script.Parent.Parent.Parent.Buttons.Visible = false
end)
|
--[[Weight and CG]]
|
Tune.Weight = 100000 -- Total weight (in pounds)
Tune.WeightBSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable)
--[[Width]] 6 ,
--[[Height]] 3.5 ,
--[[Length]] 14 }
Tune.WeightDist = 50 -- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100)
Tune.CGHeight = .8 -- Center of gravity height (studs relative to median of all wheels)
Tune.WBVisible = false -- Makes the weight brick visible
--Unsprung Weight
Tune.FWheelDensity = 1 -- Front Wheel Density
Tune.RWheelDensity = 1 -- Rear Wheel Density
Tune.FWLgcyDensity = 1 -- Front Wheel Density [PGS OFF]
Tune.RWLgcyDensity = 1 -- Rear Wheel Density [PGS OFF]
Tune.AxleSize = 5 -- Size of structural members (larger = more stable/carry more weight)
Tune.AxleDensity = 1 -- Density of structural members
|
--[[**
ensure value is an Instance and it's ClassName matches the given ClassName
@param className The class name to check for
@returns A function that will return true iff the condition is passed
**--]]
|
function t.instanceOf(className, childTable)
assert(t.string(className))
local childrenCheck
if childTable ~= nil then
childrenCheck = t.children(childTable)
end
return function(value)
local instanceSuccess = t.Instance(value)
if not instanceSuccess then
return false
end
if value.ClassName ~= className then
return false
end
if childrenCheck then
local childrenSuccess = childrenCheck(value)
if not childrenSuccess then
return false
end
end
return true
end
end
t.instance = t.instanceOf
|
-- Mouse
-- Stephen Leitnick
-- November 07, 2020
|
local Trove = require(script.Parent.Parent.Trove)
local Signal = require(script.Parent.Parent.Signal)
local UserInputService = game:GetService("UserInputService")
local RAY_DISTANCE = 1000
|
-- Setup Items
|
local Button = WaitForItem(StealthLava.Parent, "ClickDetector")
local Head = WaitForItem(StealthLava.Parent, "Head")
|
-- connect events
|
Humanoid.Died:connect(onDied)
Humanoid.Running:connect(onRunning)
Humanoid.Jumping:connect(onJumping)
Humanoid.Climbing:connect(onClimbing)
Humanoid.GettingUp:connect(onGettingUp)
Humanoid.FreeFalling:connect(onFreeFall)
Humanoid.FallingDown:connect(onFallingDown)
Humanoid.Seated:connect(onSeated)
Humanoid.PlatformStanding:connect(onPlatformStanding)
Humanoid.Swimming:connect(onSwimming)
playAnimation("idle", 0.1, Humanoid)
pose = "Standing"
while Character.Parent ~= nil do
local _, currentGameTime = wait(0.1)
stepAnimate(currentGameTime)
end
|
-- Set up portals
|
for _,portal in pairs(workspace.Portals:GetChildren()) do
local label = script.PortalLabel:Clone()
label.RankLabel.Text = portal.RequiredRank.Value
label.Parent = portal.Portal
portal.Portal.Touched:Connect(function(part)
local player = players:GetPlayerFromCharacter(part.Parent)
if player and player.Stats.Rank.Value >= portal.RequiredRank.Value and not portal:FindFirstChild(player.Name .. "Cooldown") then
replicatedStorage.ClientRemotes.TeleportToArea:FireClient(player, portal.AreaToTeleportTo.Value.Name)
player.Stats.CurrentArea.Value = portal.AreaToTeleportTo.Value
player.RespawnLocation = portal.AreaToTeleportTo.Value.Spawn
local tag = Instance.new("Model")
tag.Name = player.Name .. "Cooldown"
tag.Parent = portal
game:GetService("Debris"):AddItem(tag, 3)
end
end)
end
|
-------------------------
|
function DoorClose()
if Shaft00.MetalDoor.CanCollide == false then
Shaft00.MetalDoor.CanCollide = true
while Shaft00.MetalDoor.Transparency > 0.0 do
Shaft00.MetalDoor.Transparency = Shaft00.MetalDoor.Transparency - .1
wait(0.000001)
end
end
if Shaft01.MetalDoor.CanCollide == false then
Shaft01.MetalDoor.CanCollide = true
while Shaft01.MetalDoor.Transparency > 0.0 do
Shaft01.MetalDoor.Transparency = Shaft01.MetalDoor.Transparency - .1
wait(0.000001)
end
end
if Shaft02.MetalDoor.CanCollide == false then
Shaft02.MetalDoor.CanCollide = true
while Shaft02.MetalDoor.Transparency > 0.0 do
Shaft02.MetalDoor.Transparency = Shaft02.MetalDoor.Transparency - .1
wait(0.000001)
end
end
if Shaft03.MetalDoor.CanCollide == false then
Shaft03.MetalDoor.CanCollide = true
while Shaft03.MetalDoor.Transparency > 0.0 do
Shaft03.MetalDoor.Transparency = Shaft03.MetalDoor.Transparency - .1
wait(0.000001)
end
end
if Shaft04.MetalDoor.CanCollide == false then
Shaft04.MetalDoor.CanCollide = true
while Shaft04.MetalDoor.Transparency > 0.0 do
Shaft04.MetalDoor.Transparency = Shaft04.MetalDoor.Transparency - .1
wait(0.000001)
end
end
if Shaft05.MetalDoor.CanCollide == false then
Shaft05.MetalDoor.CanCollide = true
while Shaft05.MetalDoor.Transparency > 0.0 do
Shaft05.MetalDoor.Transparency = Shaft05.MetalDoor.Transparency - .1
wait(0.000001)
end
end
if Shaft06.MetalDoor.CanCollide == false then
Shaft06.MetalDoor.CanCollide = true
while Shaft06.MetalDoor.Transparency > 0.0 do
Shaft06.MetalDoor.Transparency = Shaft06.MetalDoor.Transparency - .1
wait(0.000001)
end
end
if Shaft07.MetalDoor.CanCollide == false then
Shaft07.MetalDoor.CanCollide = true
while Shaft07.MetalDoor.Transparency > 0.0 do
Shaft07.MetalDoor.Transparency = Shaft07.MetalDoor.Transparency - .1
wait(0.000001)
end
end
if Shaft08.MetalDoor.CanCollide == false then
Shaft08.MetalDoor.CanCollide = true
while Shaft08.MetalDoor.Transparency > 0.0 do
Shaft08.MetalDoor.Transparency = Shaft08.MetalDoor.Transparency - .1
wait(0.000001)
end
end
if Shaft09.MetalDoor.CanCollide == false then
Shaft09.MetalDoor.CanCollide = true
while Shaft09.MetalDoor.Transparency > 0.0 do
Shaft09.MetalDoor.Transparency = Shaft09.MetalDoor.Transparency - .1
wait(0.000001)
end
end
if Shaft10.MetalDoor.CanCollide == false then
Shaft10.MetalDoor.CanCollide = true
while Shaft10.MetalDoor.Transparency > 0.0 do
Shaft10.MetalDoor.Transparency = Shaft10.MetalDoor.Transparency - .1
wait(0.000001)
end
end
if Shaft11.MetalDoor.CanCollide == false then
Shaft11.MetalDoor.CanCollide = true
while Shaft11.MetalDoor.Transparency > 0.0 do
Shaft11.MetalDoor.Transparency = Shaft11.MetalDoor.Transparency - .1
wait(0.000001)
end
end
if Shaft12.MetalDoor.CanCollide == false then
Shaft12.MetalDoor.CanCollide = true
while Shaft12.MetalDoor.Transparency > 0.0 do
Shaft12.MetalDoor.Transparency = Shaft12.MetalDoor.Transparency - .1
wait(0.000001)
end
end
if Shaft13.MetalDoor.CanCollide == false then
Shaft13.MetalDoor.CanCollide = true
while Shaft13.MetalDoor.Transparency > 0.0 do
Shaft13.MetalDoor.Transparency = Shaft13.MetalDoor.Transparency - .1
wait(0.000001)
end
end
end
function onClicked()
DoorClose()
Car.BodyVelocity.velocity = Vector3.new(0, -20, 0) --Change 10 to change the speed.
end
script.Parent.MouseButton1Click:connect(onClicked)
script.Parent.MouseButton1Click:connect(function()
if clicker == true
then clicker = false
else
return
end
end)
Car.Touched:connect(function(otherPart)
if otherPart == Elevator.Floors:FindFirstChild(script.Parent.Name)
then StopE() DoorOpen()
end
end)
function StopE()
Car.BodyVelocity.velocity = Vector3.new(0, 0, 0)
Car.BodyPosition.position = Elevator.Floors:FindFirstChild(script.Parent.Name).Position
clicker = true
end
function DoorOpen()
while Shaft00.MetalDoor.Transparency < 1.0 do
Shaft00.MetalDoor.Transparency = Shaft00.MetalDoor.Transparency + .1
wait(0.000001)
end
Shaft00.MetalDoor.CanCollide = false
end
DoorOpen()
|
--[=[
@within TableUtil
@function Reduce
@param tbl table
@param predicate (accumulator: any, value: any, index: any, tbl: table) -> result: any
@return table
Performs a reduce operation against the given table, which can be used to
reduce the table into a single value. This could be used to sum up a table
or transform all the values into a compound value of any kind.
For example:
```lua
local t = {10, 20, 30, 40}
local result = TableUtil.Reduce(t, function(accum, value)
return accum + value
end)
print(result) --> 100
```
]=]
|
local function Reduce<T, R>(t: { T }, predicate: (R, T, any, { T }) -> R, init: R): R
assert(type(t) == "table", "First argument must be a table")
assert(type(predicate) == "function", "Second argument must be a function")
local result = init :: R
if #t > 0 then
local start = 1
if init == nil then
result = (t[1] :: any) :: R
start = 2
end
for i = start, #t do
result = predicate(result, t[i], i, t)
end
else
local start = nil
if init == nil then
result = (next(t) :: any) :: R
start = result
end
for k, v in next, t, start :: any? do
result = predicate(result, v, k, t)
end
end
return result
end
|
--Rescripted by Luckymaxer
|
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Players = game:GetService("Players")
ServerControl = Tool:WaitForChild("ServerControl")
ClientControl = Tool:WaitForChild("ClientControl")
ClientControl.OnClientInvoke = (function(Mode, Value)
if Mode == "PlaySound" and Value then
Value:Play()
end
end)
function InvokeServer(Mode, Value, arg)
pcall(function()
ServerControl:InvokeServer(Mode, Value, arg)
end)
end
function Equipped(Mouse)
Character = Tool.Parent
Player = Players:GetPlayerFromCharacter(Character)
Humanoid = Character:FindFirstChild("Humanoid")
if not Player or not Humanoid or Humanoid.Health == 0 then
return
end
Mouse.Button1Down:connect(function()
InvokeServer("Click", true, Mouse.Hit.p)
end)
end
local function Unequipped()
end
script.Parent:GetPropertyChangedSignal("Parent"):Connect(function()
if script.Parent.Parent == game.Players.LocalPlayer.Character then
Equipped(game.Players.LocalPlayer:GetMouse())
else
Unequipped()
end
end)
|
--// Admin
|
return function(Vargs, GetEnv)
local env = GetEnv(nil, {script = script})
setfenv(1, env)
local server = Vargs.Server;
local service = Vargs.Service;
local cloneTable = service.CloneTable;
local Functions, Admin, Anti, Core, HTTP, Logs, Remote, Process, Variables, Settings, Commands
local AddLog, TrackTask, Defaults
local CreatorId = game.CreatorType == Enum.CreatorType.User and game.CreatorId or service.GetGroupCreatorId(game.CreatorId)
local function Init()
Functions = server.Functions;
Admin = server.Admin;
Anti = server.Anti;
Core = server.Core;
HTTP = server.HTTP;
Logs = server.Logs;
Remote = server.Remote;
Process = server.Process;
Variables = server.Variables;
Settings = server.Settings;
Commands = server.Commands;
Defaults = server.Defaults
TrackTask = service.TrackTask
AddLog = Logs.AddLog;
TrackTask("Thread: ChatServiceHandler", function()
--// Support for modern TextChatService
if service.TextChatService and service.TextChatService.ChatVersion == Enum.ChatVersion.TextChatService and Settings.OverrideChatCallbacks then
local function onNewTextchannel(textchannel)
AddLog("Script", "Connected to textchannel: "..textchannel.Name)
textchannel.ShouldDeliverCallback = function(chatMessage, textSource)
if
chatMessage.Status == Enum.TextChatMessageStatus.Success
or chatMessage.Status == Enum.TextChatMessageStatus.Sending
then
local player = service.Players:GetPlayerByUserId(textSource.UserId)
local slowCache = Admin.SlowCache
if not player then
return true
elseif Admin.DoHideChatCmd(player, chatMessage.Text) then -- // Hide chat commands?
return false
elseif Admin.IsMuted(player) then -- // Mute handler
Remote.MakeGui(player, "Notification", {
Title = "You are muted!";
Message = "You are muted and cannot talk in the chat right now.";
Time = 10;
})
return false
elseif Admin.SlowMode and not Admin.CheckAdmin(player) and slowCache[player] and os.time() - slowCache[player] < Admin.SlowMode then
Remote.MakeGui(player, "Notification", {
Title = "You are chatting too fast!";
Message = string.format("[Adonis] :: Slow mode enabled! (%g second(s) remaining)", Admin.SlowMode - (os.time() - slowCache[player]));
Time = 10;
})
return false
end
if Variables.DisguiseBindings[textSource.UserId] then -- // Disguise command handler
chatMessage.PrefixText = Variables.DisguiseBindings[textSource.UserId].TargetUsername..":"
end
if Admin.SlowMode then
slowCache[player] = os.time()
end
end
return true
end
end
local function onTextChannelsAdded(textChannels)
for _, v in textChannels:GetChildren() do
if v:IsA("TextChannel") then
task.spawn(onNewTextchannel, v)
end
end
textChannels.ChildAdded:Connect(function(child)
if child:IsA("TextChannel") then
task.spawn(onNewTextchannel, child)
end
end)
end
if service.TextChatService:FindFirstChild("TextChannels") then
task.spawn(pcall, onTextChannelsAdded, service.TextChatService:FindFirstChild("TextChannels"))
end
service.TextChatService.ChildAdded:Connect(function(child)
if child.Name == "TextChannels" then
task.spawn(onTextChannelsAdded, child)
end
end)
AddLog("Script", "TextChatService Handler Loaded")
end
--// Support for legacy Lua chat system
--// ChatService mute handler (credit to Coasterteam)
local chatService = Functions.GetChatService()
if chatService then
chatService:RegisterProcessCommandsFunction("ADONIS_CMD", function(speakerName, message)
local speaker = chatService:GetSpeaker(speakerName)
local speakerPlayer = speaker and speaker:GetPlayer()
if not speakerPlayer then
return false
end
if Admin.DoHideChatCmd(speakerPlayer, message) then
return true
end
return false
end)
chatService:RegisterProcessCommandsFunction("ADONIS_MUTE_SERVER", function(speakerName, _, channelName)
local slowCache = Admin.SlowCache
local speaker = chatService:GetSpeaker(speakerName)
local speakerPlayer = speaker and speaker:GetPlayer()
if not speakerPlayer then
return false
end
if speakerPlayer and Admin.IsMuted(speakerPlayer) then
speaker:SendSystemMessage("[Adonis] :: You are muted!", channelName)
return true
elseif speakerPlayer and Admin.SlowMode and not Admin.CheckAdmin(speakerPlayer) and slowCache[speakerPlayer] and os.time() - slowCache[speakerPlayer] < Admin.SlowMode then
speaker:SendSystemMessage(string.format("[Adonis] :: Slow mode enabled! (%g second(s) remaining)", Admin.SlowMode - (os.time() - slowCache[speakerPlayer])), channelName)
return true
end
if Admin.SlowMode then
slowCache[speakerPlayer] = os.time()
end
return false
end)
AddLog("Script", "ChatService Handler Loaded")
else
warn("Place is missing ChatService; Vanilla Roblox chat related features may not work")
AddLog("Script", "ChatService Handler Not Found")
end
end)
--// Make sure the default ranks are always present for compatability with existing commands
local Ranks = Settings.Ranks
for rank, data in Defaults.Settings.Ranks do
if not Ranks[rank] then
for r, d in Ranks do
if d.Level == data.Level then
data.Hidden = true
break
end
end
Ranks[rank] = data
end
end
--// Old settings/plugins backwards compatibility
for _, rank in {"Owners", "HeadAdmins", "Admins", "Moderators", "Creators"} do
if Settings[rank] then
Settings.Ranks[if rank == "Owners" then "HeadAdmins" else rank].Users = Settings[rank]
end
end
--[[Settings.HeadAdmins = Settings.Ranks.HeadAdmins.Users;
Settings.Admins = Settings.Ranks.Admins.Users;
Settings.Moderators = Settings.Ranks.Moderators.Users;--]]
if Settings.CustomRanks then
local Ranks = Settings.Ranks
for name, users in Settings.CustomRanks do
if not Ranks[name] then
Ranks[name] = {
Level = 1;
Users = users;
};
end
end
end
if Settings.CommandCooldowns then
for cmdName, cooldownData in Settings.CommandCooldowns do
local realCmd = Admin.GetCommand(cmdName)
if realCmd then
if cooldownData.Player then
realCmd.PlayerCooldown = cooldownData.Player
end
if cooldownData.Server then
realCmd.ServerCooldown = cooldownData.Server
end
if cooldownData.Cross then
realCmd.CrossCooldown = cooldownData.Cross
end
end
end
end
if Settings.CommandCooldowns then
for cmdName, cooldownData in Settings.CommandCooldowns do
local realCmd = Admin.GetCommand(cmdName)
if realCmd then
if cooldownData.Player then
realCmd.PlayerCooldown = cooldownData.Player
end
if cooldownData.Server then
realCmd.ServerCooldown = cooldownData.Server
end
if cooldownData.Cross then
realCmd.CrossCooldown = cooldownData.Cross
end
end
end
end
if Settings.CommandCooldowns then
for cmdName, cooldownData in pairs(Settings.CommandCooldowns) do
local realCmd = Admin.GetCommand(cmdName)
if realCmd then
if cooldownData.Player then
realCmd.PlayerCooldown = cooldownData.Player
end
if cooldownData.Server then
realCmd.ServerCooldown = cooldownData.Server
end
if cooldownData.Cross then
realCmd.CrossCooldown = cooldownData.Cross
end
end
end
end
Admin.Init = nil;
AddLog("Script", "Admin Module Initialized")
end;
local function RunAfterPlugins(data)
--// Backup Map
if Settings.AutoBackup then
TrackTask("Thread: Initial Map Backup", Admin.RunCommand, `{Settings.Prefix}backupmap`)
end
--// Run OnStartup Commands
for i,v in Settings.OnStartup do
warn(`Running startup command {v}`)
TrackTask(`Thread: Startup_Cmd: {v}`, Admin.RunCommand, v)
AddLog("Script", {
Text = `Startup: Executed {v}`;
Desc = `Executed startup command; {v}`;
})
end
--// Check if Shutdownlogs is set and if not then set it
if Core.DataStore and not Core.GetData("ShutdownLogs") then
Core.SetData("ShutdownLogs", {})
end
Admin.RunAfterPlugins = nil;
AddLog("Script", "Admin Module RunAfterPlugins Finished")
end
service.MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, id, purchased)
if Variables and player.Parent and id == 1348327 and purchased then
Variables.CachedDonors[tostring(player.UserId)] = os.time()
end
end)
local function stripArgPlaceholders(alias)
return service.Trim(string.gsub(alias, "<%S+>", ""))
end
local function FormatAliasArgs(alias, aliasCmd, msg)
local uniqueArgs = {}
local argTab = {}
local numArgs = 0
--// First try to extract args info from the alias
for arg in string.gmatch(alias, "<(%S+)>") do
if arg ~= "" and arg ~= " " then
local arg = `<{arg}>`
if not uniqueArgs[arg] then
numArgs += 1
uniqueArgs[arg] = true
table.insert(argTab, arg)
end
end
end
--// If no args in alias string, check the command string instead and try to guess args based on order of appearance
if numArgs == 0 then
for arg in string.gmatch(aliasCmd, "<(%S+)>") do
if arg ~= "" and arg ~= " " then
local arg = `<{arg}>`
if not uniqueArgs[arg] then --// Get only unique placeholder args, repeats will be matched to the same arg pos
numArgs += 1
uniqueArgs[arg] = true --// :cmd <arg1> <arg2>
table.insert(argTab, arg)
end
end
end
end
local suppliedArgs = Admin.GetArgs(msg, numArgs) -- User supplied args (when running :alias arg)
local out = aliasCmd
local EscapeSpecialCharacters = service.EscapeSpecialCharacters
for i,argType in argTab do
local replaceWith = suppliedArgs[i]
if replaceWith then
out = string.gsub(out, EscapeSpecialCharacters(argType), replaceWith)
end
end
return out
end
server.Admin = {
Init = Init;
RunAfterPlugins = RunAfterPlugins;
SpecialLevels = {};
TempAdmins = {};
PrefixCache = {};
CommandCache = {};
SlowCache = {};
UserIdCache = {};
GroupsCache = {};
BlankPrefix = false;
--// How long admin levels will be cached (unless forcibly updated via something like :admin user)
AdminLevelCacheTimeout = 30;
DoHideChatCmd = function(p: Player, message: string, data: {[string]: any}?)
local pData = data or Core.GetPlayer(p)
if pData.Client.HideChatCommands then
if Variables.BlankPrefix and
(string.sub(message,1,1) ~= Settings.Prefix or string.sub(message,1,1) ~= Settings.PlayerPrefix) then
local isCMD = Admin.GetCommand(message)
if isCMD then
return true
else
return false
end
elseif (string.sub(message,1,1) == Settings.Prefix or string.sub(message,1,1) == Settings.PlayerPrefix)
and string.sub(message,2,2) ~= string.sub(message,1,1) then
return true;
end
end
end;
GetPlayerGroups = function(p: Player)
if not p or p.Parent ~= service.Players then
return {}
end
return Admin.GetGroups(p.UserId)
end;
GetPlayerGroup = function(p, group)
local groups = Admin.GetPlayerGroups(p)
local isId = type(group) == "number"
if groups and #groups > 0 then
for _, g in groups do
if (isId and g.Id == group) or (not isId and g.Name == group) then
return g
end
end
end
end;
GetGroups = function(uid, updateCache)
uid = tonumber(uid)
if type(uid) == "number" then
local existCache = Admin.GroupsCache[uid]
local canUpdate = false
if not updateCache then
--> Feel free to adjust the time to update over or less than 300 seconds (5 minutes).
--> 300 seconds is recommended in the event of unexpected server breakdowns with Roblox and faster performance.
if existCache and (os.time()-existCache.LastUpdated > 300) then
canUpdate = true
elseif not existCache then
canUpdate = true
end
else
canUpdate = true
end
if canUpdate then
local cacheTab = {
Groups = (existCache and existCache.Groups) or {};
LastUpdated = os.time();
}
Admin.GroupsCache[uid] = cacheTab
local suc,groups = pcall(function()
return service.GroupService:GetGroupsAsync(uid) or {}
end)
if suc and type(groups) == "table" then
cacheTab.Groups = groups
return cacheTab.Groups
end
Admin.GroupsCache[uid] = cacheTab
return cloneTable(cacheTab.Groups)
else
return cloneTable((existCache and existCache.Groups) or {})
end
end
end;
GetGroupLevel = function(uid, groupId)
groupId = tonumber(groupId)
if groupId then
local groups = Admin.GetGroups(uid) or {}
for _, group in groups do
if group.Id == groupId then
return group.Rank
end
end
end
return 0
end;
CheckInGroup = function(uid, groupId)
local groups = Admin.GetGroups(uid) or {}
groupId = tonumber(groupId)
if groupId then
for i,group in groups do
if group.Id == groupId then
return true
end
end
end
return false
end,
IsLax = function(str)
for _, v in {"plr", "user", "player", "brickcolor"} do
if string.match(string.lower(str), v) then
return true
end
end
return false
end,
IsMuted = function(player)
local DoCheck = Admin.DoCheck
for _, v in Settings.Muted do
if DoCheck(player, v) then
return true
end
end
for _, v in HTTP.Trello.Mutes do
if DoCheck(player, v) then
return true
end
end
if HTTP.WebPanel.Mutes then
for _, v in HTTP.WebPanel.Mutes do
if DoCheck(player, v) then
return true
end
end
end
end;
DoCheck = function(pObj, check, banCheck)
local pType = typeof(pObj)
local cType = typeof(check)
local pUnWrapped = service.UnWrap(pObj)
local plr: Player = if pType == "userdata" and pObj:IsA("Player") then pObj
elseif pType == "number" then service.Players:GetPlayerByUserId(pObj)
elseif pType == "string" then service.Players:FindFirstChild(pObj)
elseif typeof(pUnWrapped) == "Instance" and pUnWrapped:IsA("Player") then pUnWrapped
elseif pType == "userdata" then service.Players:GetPlayerByUserId(pObj.UserId)
else nil
if not plr then
return false
end
if cType == "number" then
return plr.UserId == check
elseif cType == "string" then
if plr.Name == check then
return true
end
local filterName, filterData = string.match(check, "^(.-):(.+)$")
if filterName then
filterName = string.lower(filterName)
else
return false
end
if filterName == "group" then
local groupId = tonumber((string.match(filterData, "^%d+")))
if groupId then
local plrRank = Admin.GetGroupLevel(plr.UserId, groupId)
local requiredRank = tonumber((string.match(filterData, "^%d+:(.+)$")))
if requiredRank then
return plrRank == requiredRank or (requiredRank < 0 and plrRank >= math.abs(requiredRank))
end
return plrRank > 0
end
return false
elseif filterName == "item" then
local itemId = tonumber((string.match(filterData, "^%d+")))
return itemId and service.CheckAssetOwnership(plr, itemId)
elseif filterName == "gamepass" then
local gamepassId = tonumber((string.match(filterData, "^%d+")))
return gamepassId and service.CheckPassOwnership(plr, gamepassId)
else
local username, userId = string.match(check, "^(.*):(.*)")
if username and userId and (plr.UserId == tonumber(userId) or string.lower(plr.Name) == string.lower(username)) then
return true
end
if not banCheck and type(check) == "string" and not string.find(check, ":") then
local cache = Functions.GetUserIdFromNameAsync(check)
if cache and plr.UserId == cache then
return true
end
end
end
elseif cType == "table" then
local groupId, rank = check.Group, check.Rank
if groupId and rank then
local plrGroupInfo = Admin.GetPlayerGroup(plr, groupId)
if plrGroupInfo then
local plrRank = plrGroupInfo.Rank
return plrRank == rank or (rank < 0 and plrRank >= math.abs(rank))
end
end
end
return check == plr
end;
LevelToList = function(lvl)
local lvl = tonumber(lvl)
if not lvl then return nil end
local listName = Admin.LevelToListName(lvl)
if listName then
local list = Settings.Ranks[listName];
if list then
return list.Users, listName, list;
end
end
end;
LevelToListName = function(lvl)
if lvl > 999 then
return "Place Owner"
elseif lvl == 0 then
return "Players"
end
--// Check if this is a default rank and if the level matches the default (so stuff like [Trello] Admins doesn't appear in the command list)
for i,v in server.Defaults.Settings.Ranks do
local tRank = Settings.Ranks[i];
if tRank and tRank.Level == v.Level and v.Level == lvl then
return i
end
end
for i,v in Settings.Ranks do
if v.Level == lvl then
return i
end
end
end;
UpdateCachedLevel = function(p, data)
local data = data or Core.GetPlayer(p)
local oLevel, oRank = data.AdminLevel, data.AdminRank
local level, rank = Admin.GetUpdatedLevel(p, data)
data.AdminLevel = level
data.AdminRank = rank
data.LastLevelUpdate = os.time()
AddLog("Script", {
Text = `Updating cached level for {p.Name}`;
Desc = `Updating the cached admin level for {p.Name}`;
Player = p;
})
if Settings.Console and (oLevel ~= level or oRank ~= rank) then
if not Settings.Console_AdminsOnly or (Settings.Console_AdminsOnly and level > 0) then
task.defer(Remote.RefreshGui, p, "Console")
else
task.defer(Remote.RemoveGui, p, "Console")
end
end
return level, rank
end;
GetLevel = function(p)
local data = Core.GetPlayer(p)
local level = data.AdminLevel
local rank = data.AdminRank
local lastUpdate = data.LastLevelUpdate or 0
local clients = Remote.Clients
local key = tostring(p.UserId)
local currentTime = os.time()
if (not level or not lastUpdate or currentTime - lastUpdate > Admin.AdminLevelCacheTimeout) or lastUpdate > currentTime then
local newLevel, newRank = Admin.UpdateCachedLevel(p, data)
if clients[key] and level and newLevel and type(p) == "userdata" and p:IsA("Player") then
if newLevel < level then
Functions.Hint(`Your admin level has been reduced to {newLevel} [{newRank or "Unknown"}]`, {p})
elseif newLevel > level then
Functions.Hint(`Your admin level has been increased to {newLevel} [{newRank or "Unknown"}]`, {p})
end
end
return newLevel, newRank
end
return level or 0, rank;
end;
GetUpdatedLevel = function(p, data)
local checkTable = Admin.CheckTable
local doCheck = Admin.DoCheck
--[[if data and data.AdminLevelOverride then
return data.AdminLevelOverride
end--]]
for _, admin in Admin.SpecialLevels do
if doCheck(p, admin.Player) then
return admin.Level, admin.Rank
end
end
local sortedRanks = {}
for rank, data in Settings.Ranks do
table.insert(sortedRanks, {
Rank = rank;
Users = data.Users;
Level = data.Level;
});
end
table.sort(sortedRanks, function(t1, t2)
return t1.Level > t2.Level
end)
local highestLevel = 0
local highestRank = nil
for _, data in sortedRanks do
local level = data.Level
if level > highestLevel then
for _, v in data.Users do
if doCheck(p, v) then
highestLevel, highestRank = level, data.Rank
break
end
end
end
end
if Admin.IsPlaceOwner(p) and highestLevel < 1000 then
return 1000, "Place Owner"
end
return highestLevel, highestRank
end;
IsPlaceOwner = function(p)
if type(p) == "userdata" and p:IsA("Player") then
--// These are my accounts; Lately I've been using my game dev account(698712377) more so I'm adding it so I can debug without having to sign out and back in (it's really a pain)
--// Disable CreatorPowers in settings if you don't trust me. It's not like I lose or gain anything either way. Just re-enable it BEFORE telling me there's an issue with the script so I can go to your place and test it.
if Settings.CreatorPowers and table.find({1237666, 76328606, 698712377}, p.UserId) then
return true
end
if tonumber(CreatorId) and p.UserId == CreatorId then
return true
end
if p.UserId == -1 and Variables.IsStudio then --// To account for player emulators in multi-client Studio tests
return true
end
end
end;
CheckAdmin = function(p)
return Admin.GetLevel(p) > 0
end;
SetLevel = function(p, level, doSave, rankName)
local current, rank = Admin.GetLevel(p)
if tonumber(level) then
if current >= 1000 then
return false
else
Admin.SpecialLevels[tostring(p.UserId)] = {
Player = p.UserId,
Level = level,
Rank = rankName
}
--[[if doSave then
local data = Core.GetPlayer(p)
if data then
data.AdminLevelOverride = level;
end
end--]]
end
elseif level == "Reset" then
Admin.SpecialLevels[tostring(p.UserId)] = nil
end
Admin.UpdateCachedLevel(p)
end;
IsTempAdmin = function(p)
local DoCheck = Admin.DoCheck
for i,v in Admin.TempAdmins do
if DoCheck(p,v) then
return true, i
end
end
end;
RemoveAdmin = function(p, temp, override)
local current, rank = Admin.GetLevel(p)
local listData = rank and Settings.Ranks[rank]
local listName = listData and rank
local list = listData and listData.Users
local isTemp,tempInd = Admin.IsTempAdmin(p)
if isTemp then
temp = true
table.remove(Admin.TempAdmins, tempInd)
end
if override then
temp = false
end
if type(p) == "userdata" then
Admin.SetLevel(p, 0)
end
if list then
local DoCheck = Admin.DoCheck
for ind,check in list do
if DoCheck(p, check) and not (type(check) == "string" and (string.match(check,"^Group:") or string.match(check,"^Item:"))) then
table.remove(list, ind)
if not temp and Settings.SaveAdmins then
TrackTask("Thread: RemoveAdmin", Core.DoSave, {
Type = "TableRemove";
Table = {"Settings", "Ranks", listName, "Users"};
Value = check;
})
end
end
end
end
Admin.UpdateCachedLevel(p)
end;
AddAdmin = function(p, level, temp)
local current, rank = Admin.GetLevel(p)
local list = rank and Settings.Ranks[rank]
local levelName, newRank, newList
if type(level) == "string" then
local newRank = Settings.Ranks[level]
levelName = newRank and level
newList = newRank and newRank.Users
level = (newRank and newRank.Level) or Admin.StringToComLevel(levelName) or level
else
local nL, nLN = Admin.LevelToList(level)
levelName = nLN
newRank = nLN
newList = nL
end
Admin.RemoveAdmin(p, temp)
Admin.SetLevel(p, level, nil, levelName)
if temp then
table.insert(Admin.TempAdmins, p)
end
if list and type(list) == "table" then
local index,value
for ind,ent in list do
if (type(ent)=="number" or type(ent)=="string") and (ent==p.UserId or string.lower(ent)==string.lower(p.Name) or string.lower(ent)==string.lower(`{p.Name}:{p.UserId}`)) then
index = ind
value = ent
end
end
if index and value then
table.remove(list, index)
end
end
local value = `{p.Name}:{p.UserId}`
if newList then
table.insert(newList, value)
if Settings.SaveAdmins and levelName and not temp then
TrackTask("Thread: SaveAdmin", Core.DoSave, {
Type = "TableAdd";
Table = {"Settings", "Ranks", levelName, "Users"};
Value = value
})
end
end
Admin.UpdateCachedLevel(p)
end;
CheckDonor = function(p)
--if not Settings.DonorPerks then return false end
local key = tostring(p.UserId)
if Variables.CachedDonors[key] then
return true
else
--if p.UserId<0 or (tonumber(p.AccountAge) and tonumber(p.AccountAge)<0) then return false end
local pGroup = Admin.GetPlayerGroup(p, 886423)
for _, pass in Variables.DonorPass do
if p.Parent ~= service.Players then
return false
end
local ran, ret
if type(pass) == "number" then
ran, ret = pcall(service.MarketPlace.UserOwnsGamePassAsync, service.MarketPlace, p.UserId, pass)
elseif type(pass) == "string" and tonumber(pass) then
ran, ret = pcall(service.MarketPlace.PlayerOwnsAsset, service.MarketPlace, p, tonumber(pass))
end
if (ran and ret) or (pGroup and pGroup.Rank >= 10) then --// Complimentary donor access is given to Adonis contributors & developers.
Variables.CachedDonors[key] = os.time()
return true
end
end
end
end;
CheckBan = function(p)
local doCheck = Admin.DoCheck
local banCheck = Admin.DoBanCheck
for ind, admin in Settings.Banned do
if (type(admin) == "table" and ((admin.UserId and doCheck(p, admin.UserId, true)) or (admin.Name and not admin.UserId and doCheck(p, admin.Name, true)))) or doCheck(p, admin, true) then
return true, (type(admin) == "table" and admin.Reason)
end
end
for ind, ban in Core.Variables.TimeBans do
if p.UserId == ban.UserId then
if ban.EndTime-os.time() <= 0 then
table.remove(Core.Variables.TimeBans, ind)
else
return true, `\n Reason: {ban.Reason or "(No reason provided.)"}\n Banned until {service.FormatTime(ban.EndTime, {WithWrittenDate = true})}`
end
end
end
for ind, admin in HTTP.Trello.Bans do
local name = type(admin) == "table" and admin.Name or admin
if doCheck(p, name) or banCheck(p, name) then
return true, (type(admin) == "table" and admin.Reason and service.Filter(admin.Reason, p, p))
end
end
if HTTP.WebPanel.Bans then
for ind, admin in HTTP.WebPanel.Bans do
if doCheck(p, admin) or banCheck(p, admin) then
return true, (type(admin) == "table" and admin.Reason)
end
end
end
end;
AddBan = function(p, reason, doSave, moderator)
local value = {
Name = p.Name;
UserId = p.UserId;
Reason = reason;
Moderator = if moderator then service.FormatPlayer(moderator) else "%SYSTEM%";
}
table.insert(Settings.Banned, value)--`{p.Name}:{p.UserId}`
if doSave then
Core.DoSave({
Type = "TableAdd";
Table = "Banned";
Value = value;
})
Core.CrossServer("RemovePlayer", p.Name, Variables.BanMessage, value.Reason or "No reason provided")
end
if type(p) ~= "table" then
if not service.Players:FindFirstChild(p.Name) then
Remote.Send(p,'Function','KillClient')
else
if p then pcall(function() p:Kick(`{Variables.BanMessage} | Reason: {value.Reason or "No reason provided"}`) end) end
end
end
service.Events.PlayerBanned:Fire(p, reason, doSave, moderator)
end;
AddTimeBan = function(p : Player | {[string]: any}, duration: number, reason: string, moderator: Player?)
local value = {
Name = p.Name;
UserId = p.UserId;
EndTime = os.time() + tonumber(duration);
Reason = reason;
Moderator = if moderator then service.FormatPlayer(moderator) else "%SYSTEM%";
}
table.insert(Core.Variables.TimeBans, value)
Core.DoSave({
Type = "TableAdd";
Table = {"Core", "Variables", "TimeBans"};
Value = value;
})
Core.CrossServer("RemovePlayer", p.Name, Variables.BanMessage, value.Reason or "No reason provided")
if type(p) ~= "table" then
if not service.Players:FindFirstChild(p.Name) then
Remote.Send(p, "Function", "KillClient")
else
if p then pcall(function() p:Kick(`{Variables.BanMessage} | Reason: {value.Reason or "No reason provided"}`) end) end
end
end
service.Events.PlayerBanned:Fire(p, reason, true, moderator)
end,
DoBanCheck = function(name: string | number | Instance, check: string | {[string]: any})
local id = type(name) == "number" and name
if type(name) == "userdata" and name:IsA("Player") then
id = name.UserId
name = name.Name
end
if type(check) == "table" then
if type(name) == "string" and check.Name and string.lower(check.Name) == string.lower(name) then
return true
elseif id and check.UserId and check.UserId == id then
return true
end
elseif type(check) == "string" then
local cName, cId = string.match(check, "(.*):(.*)")
if not cName and cId then cName = check end
if cName then
if string.lower(cName) == string.lower(name) then
return true
elseif id and cId and id == tonumber(cId) then
return true
end
else
return string.lower(tostring(check)) == string.lower(tostring(name))
end
end
return false
end;
RemoveBan = function(name, doSave)
local ret
for i,v in Settings.Banned do
if Admin.DoBanCheck(name, v) then
ret = table.remove(Settings.Banned, i)
if doSave then
Core.DoSave({
Type = "TableRemove";
Table = "Banned";
Value = ret;
LaxCheck = true;
})
end
end
end
return ret
end;
RemoveTimeBan = function(name : string | number | Instance)
local ret
for i,v in Core.Variables.TimeBans do
if Admin.DoBanCheck(name, v) then
table.remove(Core.Variables.TimeBans, i)
ret = v
Core.DoSave({
Type = "TableRemove";
Table = {"Core", "Variables", "TimeBans"};
Value = v;
LaxCheck = true;
})
end
end
return ret
end,
RunCommand = function(coma: string, ...)
local _, com = Admin.GetCommand(coma)
if com then
local cmdArgs = com.Args or com.Arguments
local args = Admin.GetArgs(coma, #cmdArgs, ...)
--local task,ran,error = service.Threads.TimeoutRunTask(`SERVER_COMMAND: {coma}`,com.Function,60*5,false,args)
--[[local ran, error = TrackTask(`Command: {coma}`, com.Function, false, args)
if error then
--logError("SERVER","Command",error)
end]]
TrackTask(`Command: {coma}`, com.Function, false, args)
end
end;
RunCommandAsPlayer = function(coma, plr, ...)
local ind, com = Admin.GetCommand(coma)
if com then
local adminLvl = Admin.GetLevel(plr)
local cmdArgs = com.Args or com.Arguments
local args = Admin.GetArgs(coma, #cmdArgs, ...)
local ran, error = TrackTask(`{plr.Name}: {coma}`, com.Function, plr, args, {
PlayerData = {
Player = plr;
Level = adminLvl;
isDonor = ((Settings.DonorCommands or com.AllowDonors) and Admin.CheckDonor(plr)) or false;
}
})
--local task,ran,error = service.Threads.TimeoutRunTask(`COMMAND:{plr.Name}: {coma}`,com.Function,60*5,plr,args)
if error then
--logError(plr,"Command",error)
error = string.match(error, ":(.+)$") or "Unknown error"
Remote.MakeGui(plr, "Output", {
Title = '';
Message = error;
Color = Color3.new(1, 0, 0)
})
return;
end
end
end;
RunCommandAsNonAdmin = function(coma, plr, ...)
local ind, com = Admin.GetCommand(coma)
if com and com.AdminLevel == 0 then
local cmdArgs = com.Args or com.Arguments
local args = Admin.GetArgs(coma,#cmdArgs,...)
local _, error = TrackTask(`{plr.Name}: {coma}`, com.Function, plr, args, {PlayerData = {
Player = plr;
Level = 0;
isDonor = false;
}})
if error then
error = string.match(error, ":(.+)$") or "Unknown error"
Remote.MakeGui(plr, "Output", {
Title = "";
Message = error;
Color = Color3.new(1, 0, 0)
})
end
end
end;
CacheCommands = function()
local tempTable = {}
local tempPrefix = {}
for ind, data in Commands do
if type(data) == "table" then
for i,cmd in data.Commands do
if data.Prefix == "" then Variables.BlankPrefix = true end
tempPrefix[data.Prefix] = true
tempTable[string.lower(data.Prefix..cmd)] = ind
end
end
end
Admin.PrefixCache = tempPrefix
Admin.CommandCache = tempTable
end;
GetCommand = function(Command)
if Admin.PrefixCache[string.sub(Command, 1, 1)] or Variables.BlankPrefix then
local matched
matched = if string.find(Command, Settings.SplitKey) then
string.match(Command, `^(%S+){Settings.SplitKey}`)
else string.match(Command, "^(%S+)")
if matched then
local found = Admin.CommandCache[string.lower(matched)]
if found then
local real = Commands[found]
if real then
return found,real,matched
end
end
end
end
end;
FindCommands = function(Command)
local prefixChar = string.sub(Command, 1, 1)
local checkPrefix = Admin.PrefixCache[prefixChar] and prefixChar
local matched
if checkPrefix then
Command = string.sub(Command, 2)
end
if string.find(Command, Settings.SplitKey) then
matched = string.match(Command, `^(%S+){Settings.SplitKey}`)
else
matched = string.match(Command, "^(%S+)")
end
if matched then
local foundCmds = {}
matched = string.lower(matched)
for ind,cmd in Commands do
if type(cmd) == "table" and ((checkPrefix and prefixChar == cmd.Prefix) or not checkPrefix) then
for _, alias in cmd.Commands do
if string.lower(alias) == matched then
foundCmds[ind] = cmd
break
end
end
end
end
return foundCmds
end
end;
SetPermission = function(comString, newLevel)
local cmds = Admin.FindCommands(comString)
if cmds then
for ind, cmd in cmds do
cmd.AdminLevel = newLevel
end
end
end;
FormatCommandArguments = function(command)
local text = ""
for i, arg in command.Args do
text ..= `<{arg}>`
if i < #command.Args then
text ..= Settings.SplitKey
end
end
return text
end;
FormatCommand = function(command, cmdn)
local text = (command.Prefix or "")..tostring(command.Commands[cmdn or 1])
if #command.Args > 0 then
text ..= Settings.SplitKey .. Admin.FormatCommandArguments(command)
end
return text
end;
FormatCommandAdminLevel = function(command)
local levels = if type(command.AdminLevel) == "table"
then table.clone(command.AdminLevel)
else {command.AdminLevel}
local permissionDesc = ""
for i, lvl in levels do
if type(lvl) == "number" then
local list, name, data = Admin.LevelToList(lvl)
permissionDesc ..= `{name or "No Rank"}; Level {lvl}`
elseif type(lvl) == "string" then
local numLvl = Admin.StringToComLevel(lvl)
permissionDesc ..= `{lvl}; Level {numLvl or "Unknown"}`
end
if i < #levels then
permissionDesc ..= ", "
end
end
return permissionDesc
end;
CheckTable = function(p, tab)
local doCheck = Admin.DoCheck
for i,v in tab do
if doCheck(p, v) then
return true
end
end
end;
--// Make it so you can't accidentally overwrite certain existing commands... resulting in being unable to add/edit/remove aliases (and other stuff)
CheckAliasBlacklist = function(alias)
local playerPrefix = Settings.PlayerPrefix;
local prefix = Settings.Prefix;
local blacklist = {
[`{playerPrefix}alias`] = true;
[`{playerPrefix}newalias`] = true;
[`{playerPrefix}removealias`] = true;
[`{playerPrefix}client`] = true;
[`{playerPrefix}userpanel`] = true;
[":adonissettings"] = true;
}
--return Admin.CommandCache[alias:lower()] --// Alternatively, we could make it so you can't overwrite ANY existing commands...
return blacklist[alias];
end;
GetArgs = function(msg, num, ...)
local args = Functions.Split((string.match(msg, `^.-{Settings.SplitKey}(.+)`) or ''),Settings.SplitKey,num) or {}
for _, v in {...} do
table.insert(args, v)
end
return args
end;
AliasFormat = function(aliases, msg)
local foundPlayerAlias = false --// Check if there's a player-defined alias first then otherwise check settings aliases
local CheckAliasBlacklist, EscapeSpecialCharacters = Admin.CheckAliasBlacklist, service.EscapeSpecialCharacters
if aliases then
for alias, cmd in aliases do
local tAlias = stripArgPlaceholders(alias)
if not Admin.CheckAliasBlacklist(tAlias) then
local escAlias = EscapeSpecialCharacters(tAlias)
if string.match(msg, `^{escAlias}`) or string.match(msg, `%s{escAlias}`) then
msg = FormatAliasArgs(alias, cmd, msg)
end
end
end
end
--if not foundPlayerAlias then
for alias, cmd in Settings.Aliases do
local tAlias = stripArgPlaceholders(alias)
if not CheckAliasBlacklist(tAlias) then
local escAlias = EscapeSpecialCharacters(tAlias)
if string.match(msg, `^{escAlias}`) or string.match(msg, `%s{escAlias}`) then
msg = FormatAliasArgs(alias, cmd, msg)
end
end
end
--end
return msg
end;
StringToComLevel = function(str)
local strType = type(str)
if strType == "string" and string.lower(str) == "players" then
return 0
end
if strType == "number" then
return str
end
local lvl = Settings.Ranks[str]
return (lvl and lvl.Level) or tonumber(str)
end;
CheckComLevel = function(plrAdminLevel, comLevel)
if type(comLevel) == "string" then
comLevel = Admin.StringToComLevel(comLevel)
elseif type(comLevel) == "table" then
for _, level in comLevel do
if Admin.CheckComLevel(plrAdminLevel, level) then
return true
end
end
return false
end
return type(comLevel) == "number" and plrAdminLevel >= comLevel
end;
IsBlacklisted = function(p)
local CheckTable = Admin.CheckTable
for _, list in Variables.Blacklist.Lists do
if CheckTable(p, list) then
return true
end
end
end;
CheckPermission = function(pDat, cmd, ignoreCooldown, opts)
opts = opts or {}
local adminLevel = pDat.Level
local comLevel = cmd.AdminLevel
if cmd.Disabled then
return false, "This command has been disabled."
end
if Variables.IsStudio and cmd.NoStudio then
return false, "This command cannot be used in Roblox Studio."
end
if opts.CrossServer and cmd.CrossServerDenied then
return false, "This command may not be run across servers (cross-server-blacklisted)."
end
if Admin.IsPlaceOwner(pDat.Player) or adminLevel >= Settings.Ranks.Creators.Level then
return true, nil
end
if Admin.IsBlacklisted(pDat.Player) then
return false, "You are blacklisted from running commands."
end
if (comLevel == 0 or comLevel == "Players") and adminLevel <= 0 and not Settings.PlayerCommands then
return false, "Player commands are disabled in this game."
end
if cmd.Fun and not Settings.FunCommands then
return false, "Fun commands are disabled in this game."
end
if opts.Chat and cmd.Chattable == false then
return false, "This command is not permitted as chat message (non-chattable command)."
end
local permAllowed = (cmd.Donors and (pDat.isDonor and (Settings.DonorCommands or cmd.AllowDonors)))
or Admin.CheckComLevel(adminLevel, comLevel)
if permAllowed and not ignoreCooldown and type(pDat.Player) == "userdata" then
local playerCooldown = tonumber(cmd.PlayerCooldown)
local serverCooldown = tonumber(cmd.ServerCooldown)
local crossCooldown = tonumber(cmd.CrossCooldown)
local cmdFullName = cmd._fullName or (function()
local aliases = cmd.Aliases or cmd.Commands or {}
cmd._fullName = `{cmd.Prefix}{aliases[1] or `{service.getRandom()}-RANDOM_COMMAND`}`
return cmd._fullName
end)()
local pCooldown_Cache = cmd._playerCooldownCache or (function()
local tab = {}
cmd._playerCooldownCache = tab
return tab
end)()
local sCooldown_Cache = cmd._serverCooldownCache or (function()
local tab = {}
cmd._serverCooldownCache = tab
return tab
end)()
local crossCooldown_Cache = cmd._crossCooldownCache or (function()
local tab = {}
cmd._crossCooldownCache = tab
return tab
end)()
local cooldownIndex = tostring(pDat.Player.UserId)
local pCooldown_playerCache = pCooldown_Cache[cooldownIndex]
local sCooldown_playerCache = sCooldown_Cache[cooldownIndex]
if playerCooldown and pCooldown_playerCache then
local secsTillPass = os.clock() - pCooldown_playerCache
if secsTillPass < playerCooldown then
return false, string.format("[PlayerCooldown] You must wait %.0f seconds to run the command.", playerCooldown - secsTillPass)
end
end
if serverCooldown and sCooldown_playerCache then
local secsTillPass = os.clock() - sCooldown_playerCache
if secsTillPass < serverCooldown then
return false, string.format("[ServerCooldown] You must wait %.0f seconds to run the command.", serverCooldown - secsTillPass)
end
end
if crossCooldown then
local playerData = Core.GetPlayer(pDat.Player) or {}
local crossCooldown_Cache = playerData._crossCooldownCache or (function()
local tab = {}
playerData._crossCooldownCache = tab
return tab
end)()
local crossCooldown_playerCache = crossCooldown_Cache[cmdFullName]
if crossCooldown_playerCache then
local secsTillPass = os.clock() - crossCooldown_playerCache
if secsTillPass < crossCooldown then
return false, string.format("[CrossServerCooldown] You must wait %.0f seconds to run the command.", crossCooldown - secsTillPass)
end
end
end
end
return permAllowed, nil
end;
UpdateCooldown = function(pDat, cmd)
if pDat.Player == "SYSTEM" then return end
local playerCooldown = tonumber(cmd.PlayerCooldown)
local serverCooldown = tonumber(cmd.ServerCooldown)
local crossCooldown = tonumber(cmd.CrossCooldown)
local cmdFullName = cmd._fullName or (function()
local aliases = cmd.Aliases or cmd.Commands or {}
cmd._fullName = `{cmd.Prefix}{aliases[1] or `{service.getRandom()}-RANDOM_COMMAND`}`
return cmd._fullName
end)()
local pCooldown_Cache = cmd._playerCooldownCache or (function()
local tab = {}
cmd._playerCooldownCache = tab
return tab
end)()
local sCooldown_Cache = cmd._serverCooldownCache or (function()
local tab = {}
cmd._serverCooldownCache = tab
return tab
end)()
local crossCooldown_Cache = cmd._crossCooldownCache or (function()
local tab = {}
cmd._crossCooldownCache = tab
return tab
end)()
local cooldownIndex = tostring(pDat.Player.UserId)
local pCooldown_playerCache = pCooldown_Cache[cooldownIndex]
local sCooldown_playerCache = sCooldown_Cache[cooldownIndex]
local lastUsed = os.clock()
if playerCooldown then
pCooldown_Cache[cooldownIndex] = lastUsed
end
if serverCooldown then
sCooldown_Cache[cooldownIndex] = lastUsed
end
--// Cross cooldown
do
local playerData = Core.GetPlayer(pDat.Player)
local crossCooldown_Cache = playerData._crossCooldownCache or {}
local crossCooldown_playerCache = crossCooldown_Cache[cmdFullName]
if not crossCooldown and crossCooldown_playerCache then
crossCooldown_playerCache[cmdFullName] = nil
elseif crossCooldown then
crossCooldown_Cache[cmdFullName] = lastUsed
end
end
end;
SearchCommands = function(p, search)
local checkPerm = Admin.CheckPermission
local tab = {}
local pDat = {
Player = p;
Level = Admin.GetLevel(p);
isDonor = Admin.CheckDonor(p);
}
for ind, cmd in Commands do
if checkPerm(pDat, cmd, true) then
tab[ind] = cmd
end
end
return tab
end;
CheckAuthority = function(p, target, actionName, allowSelf)
if p == target then
if allowSelf == false then
Functions.Hint(`You cannot {actionName} yourself`, {p})
return false
end
return allowSelf or Remote.GetGui(p, "YesNoPrompt", {
Question = `Are you sure you want to {actionName} yourself?`;
}) == "Yes"
elseif Admin.GetLevel(p) > Admin.GetLevel(target) then
return true
end
Functions.Hint(`You don't have permission to {actionName} {service.FormatPlayer(target)}`, {p})
return false
end;
}
end
|
--------LEFT DOOR --------
|
game.Workspace.doorleft.l21.BrickColor = BrickColor.new(106)
game.Workspace.doorleft.l41.BrickColor = BrickColor.new(1023)
game.Workspace.doorleft.pillar.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
|
-- when R is held down begin pause when released unpause
|
UIS.InputBegan:Connect(function(i, g)
if i.KeyCode ~= Enum.KeyCode.R then return end
game.ReplicatedStorage.pause:FireServer()
end)
UIS.InputEnded:Connect(function(i, g)
if i.KeyCode~=Enum.KeyCode.R then return end
game.ReplicatedStorage.unpause:FireServer()
end)
|
--// Logging
|
local clientLog = {}
local dumplog = function()
warn(":: Adonis :: Dumping client log...")
for _, v in clientLog do
warn(":: Adonis ::", v)
end
end
local log = function(...)
table.insert(clientLog, table.concat({ ... }, " "))
end
|
-- Animate the Background
|
local function imageTween(whenTweenCompleted)
clonedLoadingScreen.Frame.Pattern:TweenPosition(UDim2.new(1, 0, 0.5, 0), "Out", "Linear", 20, false, whenTweenCompleted)
end
local function whenTweenCompleted(state)
if state == Enum.TweenStatus.Completed then
clonedLoadingScreen.Frame.Pattern.Position = UDim2.new(0, 0, 0.5, 0)
imageTween(whenTweenCompleted)
end
end
imageTween(whenTweenCompleted)
skipButton.MouseButton1Down:Connect(function()
hideLoadingScreen()
end)
frame.Visible = true
local Assets = game:GetDescendants()
local startTime = os.clock()
for i = 1, #Assets do
local asset = Assets[i]
ContentProvider:PreloadAsync({asset})
loadingPercentage.Text = "Loading experience - " ..i.. "/" ..#Assets
ResizeBar(i/#Assets)
end
hideLoadingScreen()
local deltaTime = os.clock() - startTime
print(("Loading complete, time: %.2f"):format(deltaTime))
|
--------RIGHT DOOR --------
|
game.Workspace.doorright.l11.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l12.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l13.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l41.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l42.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l43.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l71.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l72.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l73.BrickColor = BrickColor.new(106)
game.Workspace.doorright.pillar.BrickColor = BrickColor.new(106)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.