Tewpik
(Tewpik)
March 11, 2024, 11:50pm
#1
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:
Preface
I’ve been experimenting with raycasting and CFraming recently in order to become more well-rounded, and I was interested in creating platforms that Characters could automatically move with. During this process, I stumbled across a topic that tyridge77 and badcc provided insight on, as they’ve implemented trains in the respective games they work on (The Wild West & Jailbreak).
Utilizing the information provided there, including placebo code from a couple of posts, I put together somethi…
2 Likes
system
(system)
Closed
March 25, 2024, 11:59pm
#3
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.