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

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

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

3 comments

0

use text for links

0

Please include how the tool is setup.

0

instead of a while loop maybe RunService.RenderStepped would smooth it for the player https://developer.roblox.com/api-reference/event/RunService/RenderStepped

1 answer

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

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