Hi, I am building a game where you can drive a monorail, and I want you to be able to sit down and get a GUI where you can open the doors. I currently have it where when you sit down, you get two TextButtons (Open doors and Close doors) and I had this script for it. (DL stands for Doors/Left)
DoorParts=script.Parent.Parent.Parent.Parent.DL
function onButtonClicked()
DoorParts.Door.Transparency=1
DoorParts.Door.CanCollide=false
DoorParts.Door2.Transparency=1
DoorParts.Door2.CanCollide=false
DoorParts.Hello.Transparency=1
DoorParts.Hello.CanCollide=false
DoorParts.Bye.Transparency=1
DoorParts.Bye.CanCollide=false
end
script.Parent.MouseButton1Down:connect(onButtonClicked)
The problem is when a player sits down, the actual GUI is stored in players, not workspace, so when I press the button it goes to Players.Hen8 instead of DL.
Using game.Workspace.Monorail0 (The monorail’s name).Doors (DL) in place of the first line doesn’t work because you can regen the monorail, meaning you can have two identical monorail0s. So without using that,
How can I alter this code to open the doors of the exact monorail a player is sitting in and no others?
Thank you!
Sorry if this explanation is unclear, it’s pretty specific so it’s hard to explain.