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

[SOLVED] How do i move a local part?

Asked by
PastDays 108
5 years ago
Edited 5 years ago

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...)

0
u simply can't DeceptiveCaster 3761 — 5y
0
Then is the way im moving the part inefficient? PastDays 108 — 5y
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. User#24403 69 — 5y
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. PastDays 108 — 5y
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 User#24403 69 — 5y

Answer this question