Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Trying to make a part follow the camera but it is glitchy/delayed?

Asked by 5 years ago

note: i suck at scripting and roblox studio sorta

So i am making a quick tool where i want a part inside the tool to follow the camera. It works completely fine except that its a bit glitchy. It delays a bit behind the camera and i want it to be smooth but don't know how. is there a way i can fix this? here is the code i used (its a local script inside a part):

script.Parent.Transparency = 0
while true do
    script.Parent.CFrame = workspace.CurrentCamera.CFrame
    wait ()
end

pls help also here is a video showing what i mean by glitchy/delayed: https://www.youtube.com/watch?v=hJKBt4D4Eos

0
use [text](url) for links User#5423 17 — 5y
0
Please include how the tool is setup. User#5423 17 — 5y
0
instead of a while loop maybe RunService.RenderStepped would smooth it for the player https://developer.roblox.com/api-reference/event/RunService/RenderStepped GoldAngelInDisguise 297 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

you should use RenderStepped, a member of RunService

script.Parent.Transparency = 0
while true do
    game:GetService("RunService").RenderStepped:Wait()
    script.Parent.CFrame = workspace.CurrentCamera.CFrame
end

Ad

Answer this question