-- CombinedPowers_local.lua -- Local-only powers for client execution (Solarav3 / injector). -- Works reliably for local-based effects: speed, super-jump, flight. -- Push/punch attempt local impulses — may be ignored or corrected by server in many games. local Players = game:GetService("Players") local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local player = Players.LocalPlayer -- ========== CONFIG ========== local SPEED_MAX = 110 -- horizontal max speed for velocity control local SPEED_ACCEL = 110 -- how fast to reach desired horizontal speed local SPEED_TOGGLE_KEY = Enum.KeyCode.F local SUPERJUMP_KEY = Enum.KeyCode.J local SUPERJUMP_VELOCITY = 155 -- upward impulse local FLY_TOGGLE_KEY = Enum.KeyCode.K local FLY_SPEED = 800 local PUSH_KEY = Enum.KeyCode.G local PUSH_RADIUS = 12 local PUSH_FORCE = 120 -- local attempt to push others (client-side) local PUNCH_KEY = Enum.KeyCode.H local PUNCH_RADIUS = 8 local PUNCH_FORCE = 80 -- local impulse on target's HRP (client-side) local PUNCH_COOLDOWN = 0.8 local PUSH_COOLDOWN = 0.8 local CHECK_DT = 1/60 -- ============================ -- state local speedEnabled = true local flyEnabled = false local punchCooldown = false local pushCooldown = false -- helpers local function getCharacter() return player and player.Character end local function getHRP(char) return char and (char:FindFirstChild("HumanoidRootPart") or char:FindFirstChild("Torso")) end local function ensureLeaderstatsFix() -- optional: ensure a Coins/Money exists locally local char = getCharacter() if not char then return end -- nothing forced here; leaderstats are server-controlled end -- SPEED (smooth velocity control) local currentVel = Vector3.new() local speedConn local function startSpeedControl() if speedConn then speedConn:Disconnect() end speedConn = RunService.RenderStepped:Connect(function(dt) if not speedEnabled then return end local char = getCharacter() if not char then return end local hrp = getHRP(char) local humanoid = char:FindFirstChildOfClass("Humanoid") if not hrp or not humanoid then return end local moveDir = humanoid.MoveDirection local desiredVel = Vector3.new(0,0,0) if moveDir.Magnitude > 0.01 then desiredVel = moveDir.Unit * SPEED_MAX end -- current horizontal velocity local cur = Vector3.new(hrp.AssemblyLinearVelocity.X, 0, hrp.AssemblyLinearVelocity.Z) local t = math.clamp(SPEED_ACCEL * dt, 0, 1) local horiz = cur:Lerp(desiredVel, t) local vert = hrp.AssemblyLinearVelocity.Y -- apply hrp.AssemblyLinearVelocity = Vector3.new(horiz.X, vert, horiz.Z) end) end local function stopSpeedControl() if speedConn then speedConn:Disconnect() speedConn = nil end end -- SUPER JUMP local function doSuperJump() local char = getCharacter() local hrp = getHRP(char) if not hrp then return end -- Apply upward velocity locally local ok, err = pcall(function() hrp.AssemblyLinearVelocity = Vector3.new(hrp.AssemblyLinearVelocity.X, SUPERJUMP_VELOCITY, hrp.AssemblyLinearVelocity.Z) end) if not ok then -- fallback hrp.Velocity = Vector3.new(hrp.Velocity.X, SUPERJUMP_VELOCITY, hrp.Velocity.Z) end end -- FLY (local flight using RenderStepped movement) local flyConn local function toggleFly() local char = getCharacter() local hrp = getHRP(char) local humanoid = char and char:FindFirstChildOfClass("Humanoid") if not hrp or not humanoid then return end if flyEnabled then -- disable flyEnabled = false if flyConn then flyConn:Disconnect() flyConn = nil end -- restore normal physics if needed humanoid.PlatformStand = false return else flyEnabled = true humanoid.PlatformStand = true flyConn = RunService.RenderStepped:Connect(function() if not flyEnabled or not player.Character then if flyConn then flyConn:Disconnect() flyConn = nil end if humanoid then humanoid.PlatformStand = false end return end local c = player.Character local r = getHRP(c) if not r then return end -- movement by key local moveVec = Vector3.new() if UserInputService:IsKeyDown(Enum.KeyCode.W) then moveVec = moveVec + r.CFrame.LookVector end if UserInputService:IsKeyDown(Enum.KeyCode.S) then moveVec = moveVec - r.CFrame.LookVector end if UserInputService:IsKeyDown(Enum.KeyCode.A) then moveVec = moveVec - r.CFrame.RightVector end if UserInputService:IsKeyDown(Enum.KeyCode.D) then moveVec = moveVec + r.CFrame.RightVector end if UserInputService:IsKeyDown(Enum.KeyCode.Space) then moveVec = moveVec + Vector3.new(0,1,0) end if UserInputService:IsKeyDown(Enum.KeyCode.LeftControl) then moveVec = moveVec - Vector3.new(0,1,0) end if moveVec.Magnitude > 0 then local targetVel = moveVec.Unit * FLY_SPEED r.AssemblyLinearVelocity = Vector3.new(targetVel.X, targetVel.Y, targetVel.Z) else r.AssemblyLinearVelocity = Vector3.new(0,0,0) end end) end end -- LOCAL PUSH (attempt to push nearby players by setting their HRP velocity) local function doPush() if pushCooldown then return end pushCooldown = true task.delay(PUSH_COOLDOWN, function() pushCooldown = false end) local char = getCharacter() local hrp = getHRP(char) if not hrp then return end for _, other in ipairs(Players:GetPlayers()) do if other ~= player and other.Character then local ohrp = getHRP(other.Character) if ohrp then local dist = (ohrp.Position - hrp.Position).Magnitude if dist <= PUSH_RADIUS then -- local attempt to push them away local dir = (ohrp.Position - hrp.Position).Unit pcall(function() ohrp.AssemblyLinearVelocity = dir * PUSH_FORCE + Vector3.new(0, PUSH_FORCE * 0.2, 0) end) end end end end end -- LOCAL PUNCH (local visual + small impulse to nearest) local function doPunch() if punchCooldown then return end punchCooldown = true task.delay(PUNCH_COOLDOWN, function() punchCooldown = false end) local char = getCharacter() local hrp = getHRP(char) if not hrp then return end local nearest, nd = nil, math.huge for _, other in ipairs(Players:GetPlayers()) do if other ~= player and other.Character then local ohrp = getHRP(other.Character) if ohrp then local d = (ohrp.Position - hrp.Position).Magnitude if d < nd and d <= PUNCH_RADIUS then nd = d nearest = ohrp end end end end if nearest then local dir = (nearest.Position - hrp.Position).Unit pcall(function() nearest.AssemblyLinearVelocity = dir * PUNCH_FORCE + Vector3.new(0, PUNCH_FORCE * 0.1, 0) end) end end -- Input handling UserInputService.InputBegan:Connect(function(input, gameProcessed) if gameProcessed then return end if input.UserInputType ~= Enum.UserInputType.Keyboard then return end local key = input.KeyCode if key == SPEED_TOGGLE_KEY then speedEnabled = not speedEnabled if speedEnabled then startSpeedControl() else stopSpeedControl() end print("[Powers] Speed enabled:", speedEnabled) elseif key == SUPERJUMP_KEY then doSuperJump() elseif key == FLY_TOGGLE_KEY then toggleFly() print("[Powers] Fly toggled:", flyEnabled) elseif key == PUSH_KEY then doPush() elseif key == PUNCH_KEY then doPunch() end end) -- initialize when character appears local function onCharacterAdded(char) task.spawn(function() -- small delay so HRP exists local hrp = getHRP(char) local hum = char:FindFirstChildOfClass("Humanoid") if not hrp or not hum then hrp = char:WaitForChild("HumanoidRootPart", 3) hum = char:FindFirstChildOfClass("Humanoid") end -- start speed control on spawn if enabled if speedEnabled then startSpeedControl() end end) end if player.Character then onCharacterAdded(player.Character) end player.CharacterAdded:Connect(onCharacterAdded) print("[CombinedPowers] Loaded. Keys: F=Speed toggle, J=SuperJump, K=Fly toggle, G=Push(local), H=Punch(local)")