So in my game I have moving parts, I was using parts to be c-framed on the server but i am finding that lag really affects them (causes juddering),

while true do
    wait()
    for i= 1, 50 do
    script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0,0,-0.3)
    wait()
 end

	for i= 1, 50 do
		script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0,0,0.3)
		wait()
	end
end

This script doesn't work when the part is inserted locally, How can i move a local part?

(Thanks for removing my post moderator, it wasn't a subjective question but ok...)

5 comments

0

u simply can't

0

Then is the way im moving the part inefficient?

0

RunService.Heartbeat (for server), or just move them locally (I recommend the latter). Doing it locally, it will be processed on the client playing the game. The only disadvantage is that it may be out of sync with others. But I don't think they'll care. And your other post was subjective, asking what is the "better way" is more subjective than it is anything else.

0

OH I see, that was what i asked but not what i meant, sorry i didn't think of it in that way, i will refrain from that from now on.

1

Calling the wait function without any arguments (or using a VERY small number close to the default time) is a code smell; a feature in your code that can indicate an even deeper problem. You never need to wait the shortest interval possible, I suggest a higher wait time, or use RunService events like I suggested