--!strict local Players = game:GetService("Players") local ReplicatedStorage = game:GetService("ReplicatedStorage") local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local Mobility = require(ReplicatedStorage:WaitForChild("ArenaMobility") :: ModuleScript) local jumpCharge = ReplicatedStorage:WaitForChild("PowerJumpCharge") :: RemoteEvent local player = Players.LocalPlayer local springWatcher: RBXScriptConnection? = nil local lastSpring, lastDouble = 0, 0 local function body(): (Model?, Humanoid?, BasePart?) local character = player.Character local h = character and character:FindFirstChildOfClass("Humanoid") local root = character and character.PrimaryPart if player:GetAttribute("InArena") == true and character and h and root and h.Health > 0 and not h.Sit and not root.Anchored then return character, h, root end return nil, nil, nil end local function watch(character: Model) local h = character:WaitForChild("Humanoid", 8) if not h or not h:IsA("Humanoid") or player.Character ~= character then return end if springWatcher then springWatcher:Disconnect() end springWatcher = h.Jumping:Connect(function(jumping) local spring = character:GetAttribute("LootSpring") if jumping and character == player.Character and typeof(spring) == "number" and spring ~= lastSpring and player:GetAttribute("InArena") == true then lastSpring = spring jumpCharge:FireServer("Spring", spring) end end) end local respawn = player.CharacterAdded:Connect(watch) if player.Character then task.spawn(watch, player.Character) end local input = UserInputService.InputBegan:Connect(function(event, processed) if event.KeyCode ~= Enum.KeyCode.Space or processed or UserInputService:GetFocusedTextBox() then return end local character, h, root = body() if not character or not h or not root or h.FloorMaterial ~= Enum.Material.Air then return end local token = character:GetAttribute("LootDoubleUntil") if typeof(token) ~= "number" or token <= workspace:GetServerTimeNow() or token == lastDouble then return end local state = h:GetState() if state ~= Enum.HumanoidStateType.Jumping and state ~= Enum.HumanoidStateType.Freefall then return end local speed = math.sqrt(2 * workspace.Gravity * 8) root:ApplyImpulse(Vector3.yAxis * math.max(0, speed - root.AssemblyLinearVelocity.Y) * root.AssemblyMass) lastDouble = token jumpCharge:FireServer("Double", token) end) local quietSounds: {[Sound | AudioPlayer]: number} = {} local elapsed = 0 local movement = RunService.PreSimulation:Connect(function(dt) local character, h, root = body() local now = workspace:GetServerTimeNow() if root and h and h.FloorMaterial == Enum.Material.Air and Mobility.active(character, "Feather", now) and UserInputService:IsKeyDown(Enum.KeyCode.Space) and not UserInputService:GetFocusedTextBox() then local gravityDrop = workspace.Gravity * dt local lift = -13 - root.AssemblyLinearVelocity.Y + gravityDrop if lift > 0 and root.AssemblyLinearVelocity.Y < 0 then root:ApplyImpulse(Vector3.yAxis * lift * root.AssemblyMass) end end elapsed += dt if elapsed < .12 then return end elapsed %= .12 for sound, before in quietSounds do local model = sound:FindFirstAncestorOfClass("Model") if not sound.Parent or not Mobility.active(model, "Quiet", now) then if sound.Parent then sound.Volume = before end quietSounds[sound] = nil end end for _, other in Players:GetPlayers() do local model = other.Character if not model or not Mobility.active(model, "Quiet", now) then continue end local running = model.PrimaryPart and model.PrimaryPart:FindFirstChild("Running") if running and (running:IsA("Sound") or running:IsA("AudioPlayer")) then if quietSounds[running] == nil then quietSounds[running] = running.Volume end running.Volume = quietSounds[running] * .18 end end end) script.Destroying:Once(function() if springWatcher then springWatcher:Disconnect() end input:Disconnect() respawn:Disconnect() movement:Disconnect() for sound, before in quietSounds do if sound.Parent then sound.Volume = before end end end)