So I have this script that moves a model that contains a train model and a sea when W is pressed.Everything works fine except for the fact that the player is left behind when the train is moving.
seat = script.Parent
tram = script.Parent.Parent
plr = seat.Occupant
while true do
if seat.Occupant ~= nil then
print("sitting")
seat.Occupant.Parent.isDriving.Value = true
print (tram.forward.Value)
while tram.forward.Value == true do
--print(tram.tram.Position)
--seat.Position = seat.Position + Vector3.new(0, 0, -1)
--tram.Position = tram.Position + Vector3.new(0, 0, -1)
tram:SetPrimaryPartCFrame(tram:GetPrimaryPartCFrame() * CFrame.new(0,0,-1))
--seat.Occupant.Parent.HumanoidRootPart.Position = seat.Position
wait()
end
while tram.backward.Value == true do
wait()
end
end
wait()
end
What am I doing wrong?

2 comments
That is what i tried first time, but whenever the seat moved the player jumped off automatically. Isn't there any other way?
You could attach some sort of wheel with an attachment, and change the Torque depending on the user input