Looping function for CFrame

I’m trying to make it so my player’s on the client side get their camera to copy the CFrame of a part, but I’m unsure how to make the function run every 0.01 seconds or something like that. Can someone let me know how to loop a function?

If you took the time to read this, thank you for taking that time.

Use RunService.RenderStepped:

game:GetService("RunService").RenderStepped:Connect(function()

--code here runs prior to every frame being rendered

end)

This scenario involves manipulating the camera’s CFrame so you want to position it prior to the frame being rendered. For other uses you can use a while loop:

while true do

--make sure to use a wait() or the script will timeout
wait()

end

I’ll try this right now, thank you

This worked flawlessly, thank you so much for your help.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.