Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

I have this fly script but it changes speed with graphics how to fix???

So heres the script

local uis = game:GetService("UserInputService")
local rs = game:GetService("RunService")

local myPlayer = game.Players.LocalPlayer
local myChar = myPlayer.Character
local myHRP = myChar:WaitForChild("HumanoidRootPart")
local camera = game.Workspace.CurrentCamera

local flying = false
local speed = 0.5


local bp = Instance.new("BodyPosition", myHRP)
bp.MaxForce = Vector3.new()
bp.D = 10
bp.P = 10000

local bg = Instance.new("BodyGyro", myHRP)
bg.MaxTorque = Vector3.new()
bg.D = 10

function fly()
    flying = true
    bp.MaxForce = Vector3.new(400000,400000,400000)
    bg.MaxTorque = Vector3.new(400000,400000,400000)
    while flying do
        rs.RenderStepped:wait()
        bp.Position = myHRP.Position +((myHRP.Position - camera.CFrame.p).unit * speed)
        bg.CFrame = CFrame.new(camera.CFrame.p, myHRP.Position)
    end
end

function endFlying()
    bp.MaxForce = Vector3.new()
    bg.MaxTorque = Vector3.new()
    flying = false
end

uis.InputBegan:connect(function(input)
    if input.KeyCode == Enum.KeyCode.Space then
        if not flying then
            fly()
        else
            endFlying()
        end
    end

this is what it dose https://gyazo.com/70dca5942ee30da4b5135ed2942cf824

1 answer

✓ Accepted answer

Stuff like RenderStepped and Heartbeat depend on your framerate, meaning the lower it is, the slower that will fire. here's an example:

https://gyazo.com/6c3537e0a9b7fb2b67dedaeb545cfb5e

Notice how my render and heartbeat are tied to my current fps / performance. Whereas physics stay capped at 60. I would fly suuuuper fast with that script. I'd recommend maybe trying wait() ? I'm not that experienced with run service so i actually dont know but just a suggestion and some info

3 comments

0

Omg thanks so much ill try it rn!

0

it worked btw

0

k

This discussion is preserved as it was. New answers, comments, and votes are closed.