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,

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

1 comment

0

What is script.parent if it is a block detector1 cant even be used by the pathing of that