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

How can i make a part that moves, but can't be pushed by the player?

Asked by 3 years ago
Edited 3 years ago

i'm making some (ideally simple) traffic cars for my game, it's just a straight road that generates as time goes on, so no major turning is involved (lane changes at most), all i want is some cars that move forwards at a set speed and maybe change lanes randomly, but i also want these to not be able to be pushed by the player in their own car (as this could potentially mess things up), i can try doing the lane change part myself, my end goal with this question is to just get a part (or meshpart) that moves itself, yet can't be moved by a player through pushing.

i thought of using tweenservice but then i remembered that the road doesn't have an end, and a tween eventually reaches it's end which is not ideal, so i can't use that, any help with this issue would be greatly appreciated.

0
Just use tweenservice and run a new tween every interval of time. I believe tweens are automatically interpolated on the client, which would be a problem with other methods. Benbebop 1049 — 3y

1 answer

Log in to vote
0
Answered by
Xapelize 2658 Moderation Voter Community Moderator
3 years ago

You can model the whole car and change the CFrame by using :SetPrimaryPartCFrame. About cars moves you can use for loop.

Example

local model = game.Workspace.Model

for i = 1, 10, 1 do -- Min, Max, How much numbers are transferred between min and max
    model:SetPrimaryPartCFrame(0,0.5,i)
end
0
What I recommend is this, but this is not complex enough, I suggest TweenService if advanced. Xapelize 2658 — 3y
Ad

Answer this question