Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Trying to get a train to go from one end of track to the other. It wont move?

Asked by 5 years ago
Edited 5 years ago

I am trying to make a train go from one end of track to the other using tweenservice. The train won't budge. Any suggestions?

Code:

local TweenService = game:GetService("TweenService")

local train = script.Parent:WaitForChild("Train")

local tweeningInformation = TweenInfo.new(

0.5,

Enum.EasingStyle.Linear,

Enum.EasingDirection.Out,

0,

false,

0)

local trainstart = {CFrame = CFrame.new(1706.77, 51.101, -1345.47)}

local trainend = {CFrame = CFrame.new(-1310.073, 51.068, -1345.47)}

local trainstart = TweenService:Create(train,tweeningInformation,trainstart)

local trainend = TweenService:Create(train,tweeningInformation,trainend)

while wait() do

script.Parent.Detector1.Touched:Connect(function(hit)

trainstart:Play()

wait(30)

trainend:Play()

end)

end

0
What is script.parent if it is a block detector1 cant even be used by the pathing of that voidofdeathfire 148 — 5y

Answer this question