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

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

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.

1 comment

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.

1 answer

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

1 comment

0

What I recommend is this, but this is not complex enough, I suggest TweenService if advanced.

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