Player does not follow the moving platform when standing on it

I’m trying to make the player move along with the platform (train) when he stands on it, but I don’t know how to do that. (the train is a union)

Video: https://gyazo.com/ea4d877130726c6035444b38378ef8fa

This is the script I use to move the train:

local train = game.Workspace.Map.Trains.Train1

while true do

	wait(25)
	-- Move train forward
	local forwardTweenInfo = TweenInfo.new(50, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut)
	local forwardTween = game:GetService("TweenService"):Create(train, forwardTweenInfo, {Position = train.Position + train.CFrame.LookVector * 4000})
	forwardTween:Play()
	forwardTween.Completed:Wait()

	wait(25)
	-- Move train backward
	local backwardTweenInfo = TweenInfo.new(50, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut)
	local backwardTween = game:GetService("TweenService"):Create(train, backwardTweenInfo, {Position = train.Position - train.CFrame.LookVector * 4000})
	backwardTween:Play()
	backwardTween.Completed:Wait()
end

How do I make the player move along with the train?

This was something I tried to find a solution for a while back and was eventually able to with the help of an existing resources and ideas from other developers.

Here’s a thread / topic which details the issues I encountered, solutions I tried, and a working method (with completed code and an example place file in my last post of the thread) which utilized raycasting to allow players to move along with the platform:

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.