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

How to make the model moving with CFrames in the best way?

seat = script.Parent
tram = script.Parent.Parent.Parent
local plr = game.Players.LocalPlayer

while wait() do
	if seat.Occupant == nil then
		--print("sitting")
		seat.Occupant.Parent.isDriving.Value = true
		--print (tram.Body.forward.Value)
		while tram.Body.forward.Value == true do
			--Here is script which moves the train but this one doesnt work
			-- Ah, and "we have scripted things like pressing w etc"
			script.Parent.Parent.CFrame = CFrame.new(script.Parent.Parent.CFrame + Vector3.new(0,0,1))
			wait()
		end
		
		while tram.backward.Value == true do
			wait()
		end
	end
	wait()
end


How to fix that CFrame moving script, is there any good way (it need to be moved with players of course)?

1 comment

0

lerp

1 answer

✓ Accepted answer

If you want to move a Model using CFrame you could use SetPrimaryPartCFrame(). Just make sure your Model has a PrimaryPart. Read more it about here

Another way you can move your Model is using the Function TranslateBy(), which uses Vector3. Read more about it here

2 comments

1

"red more about it"

0

Lol, thanks.

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