Whats supposed to happen is you click a button, it fires an event to the server which will then open the doors on the right hand side.
When I click the button it says "TCP isn't a valid member of Player"
eventScript:
function OpenDoor(door,num)
local left = door.Left:GetChildren()
for n=1, #left do
if left[n].ClassName == "Part" then
left[n].Mesh.Offset = Vector3.new(-0.1*num, 0, 0)
if num == 36 then
left[n].CanCollide = false
end
end
end
local right = door.Right:GetChildren()
for b=1, #right do
if right[b].ClassName == "Part" then
right[b].Mesh.Offset = Vector3.new(0.1*num, 0, 0)
if num == 36 then
right[b].CanCollide = false
end
end
end
end
script.openRightDoors.OnServerEvent:connect(function(TrainVal)
if TrainVal.TCP.Dir.Value == false then
for a=1, 36 do
OpenDoor(TrainVal.Car1.Door3,a)
OpenDoor(TrainVal.Car1.Door4,a)
OpenDoor(TrainVal.Car2.Door3,a)
OpenDoor(TrainVal.Car2.Door4,a)
wait(.01)
end
else
for a=1, 36 do
OpenDoor(TrainVal.Car1.Door1,a)
OpenDoor(TrainVal.Car1.Door2,a)
OpenDoor(TrainVal.Car2.Door1,a)
OpenDoor(TrainVal.Car2.Door2,a)
wait(.01)
end
Button:
TrainVal = script.Parent.Parent.Parent.Train.Value
function onClick()
game.Workspace.traineventScript.openRightDoors:FireServer(TrainVal)
end
script.Parent.MouseButton1Click:connect(onClick)

2 comments
It's not printing anything so I'm unsure if it works or not
I would just test the remote event part first then move onto the opening of the door