So, I am trying to makea GUI that allows a player to spawn a train in a specific location, so when they click spawn it spawns in the train depot and teleports them there and then if a train is already there it won’t spawn.
How do I go about scripting this? I am not very talented with scripting so I thought I’d ask for help.
To do this, you would need a function in the UI button that fires a remote event.
With this event you would send train type, and location. (Player is sent by default.)
Then you would need a server script that reads the event, and clones the train into the location. I suggest using PrimaryPart to move the train into the right place.
Last teleport the player to the trains seat. (Set players torsos position to the trains seats position.)
Hope this helped!
-Cap
On a whim, made a place that does this for you. Now make it your own.
WARNING: Free models in use, some problematic scripts removed from them. I don’t see any remaining issues though. Please notify me if anyone finds anything inappropriate or unsafe in this file so I can fix it.
Train Depot model with a GUI to spawn a train in the depot, unless another train is already there:
train depot spawn.rbxl (254.3 KB)