Hello, I have recently begun helping my friend scripting a Northern Rail project on the Sheffield to Leeds line via Barnsley Interchange in the UK. I was asked to script the doors and whilst the tweens themselves work, the buttons don’t. When I click the button nothing happens, the open light doesn’t flash and the tween doesn’t work. Scripts are as follows:
FIRE SCRIPT (local):
script.Parent.MouseClick:Connect(function()
script.Parent.Parent.Parent.Parent.Parent.DoorOpen:FireServer()
end)
DOOR SCRIPT (server):
local tweenService = game:GetService("TweenService")
local aDoor = script.Parent.A.main
local bDoor = script.Parent.B.main
local tweenInfo = TweenInfo.new(1.5)
local aGoalOut = {}
local bGoalOut = {}
local aGoalAway = {}
local bGoalAway = {}
local aGoalIn = {}
local bGoalIn = {}
aGoalOut.CFrame = aDoor.CFrame * CFrame.new(0, 0, 0.2)
bGoalOut.CFrame = bDoor.CFrame * CFrame.new(0, 0, 0.2)
aGoalAway.CFrame = aDoor.CFrame * CFrame.new(-2.9, 0, 0.2)
bGoalAway.CFrame = bDoor.CFrame * CFrame.new(2.9, 0, 0.2)
aGoalIn.CFrame = aDoor.CFrame
bGoalIn.CFrame = bDoor.CFrame
local aTweenOut = tweenService:Create(aDoor, tweenInfo, aGoalOut)
local bTweenOut = tweenService:Create(bDoor, tweenInfo, bGoalOut)
local aTweenAway = tweenService:Create(aDoor, tweenInfo, aGoalAway)
local bTweenAway = tweenService:Create(bDoor, tweenInfo, bGoalAway)
local aTweenIn = tweenService:Create(aDoor, tweenInfo, aGoalIn)
local bTweenIn = tweenService:Create(bDoor, tweenInfo, bGoalIn)
script.Parent.DoorClosed.OnServerEvent:Connect(function()
aTweenOut:Play()
bTweenOut:Play()
wait(1.5)
aTweenAway:Play()
bTweenAway:Play()
end)
script.Parent.DoorClosed.OnServerEvent:Connect(function()
wait(2)
aTweenOut:Play()
bTweenOut:Play()
wait(1.5)
aTweenIn:Play()
bTweenIn:Play()
end)
LIGHT SCRIPT (server script):
script.Parent.Parent.Parent.Parent.DoorClosed.OnServerEvent:Connect(function()
script.Parent.Color = Color3.new(0/255, 255/255, 0/255)
wait(0.5)
script.Parent.Color = Color3.new(0/255, 0/255, 0/255)
wait(0.5)
script.Parent.Color = Color3.new(0/255, 255/255, 0/255)
wait(0.5)
script.Parent.Color = Color3.new(0/255, 0/255, 0/255)
wait(0.5)
script.Parent.Color = Color3.new(0/255, 255/255, 0/255)
wait(0.5)
script.Parent.Color = Color3.new(0/255, 0/255, 0/255)
wait(0.5)
script.Parent.Color = Color3.new(0/255, 255/255, 0/255)
end)```
I should also note that there will be multiple buttons in the future