For this script you need the following 3 Gizmos:
A Spawn Point - this is where you're going to send a person
A Script - this is what makes the action that you want to happen, happen
A trigger - this is what triggers that action
To start, open the script and name it, it is good practice or a good habit for you to always name your scripts.
Create the following variables (this takes place inside of the script):
Name: [you choose], you will later see this when you attach the script to an object, it is the part you are going to connect your Spawn Point to.
In the script, replace the: "when world is started" line of code with "when trigger is entered by player", located under the XXXXX tab. Now, drag the respawn player under the actions tab and place it in the script as the 2nd line.
End of script.
Name your trigger, this helps differentiate your triggers especially if your world has many. Inside of the triggers' property panel, attach the script which should now show up under the drop down option on the bottom right of the Triggers Property Panel.
Name your spawn point, for the same reason as you would name anything else, it helps keep your world organized. Inside of the properties panel of the spawn point, turn off the "Spawn on Start" option. Now drag the blue pill from this spawn point into the empty slot of the triggers property panel.
Now all that's left for you to do is place the trigger where you want that respawn/Teleport action to stat and place the Spawn Point where you want that trigger to send the player to.
This page was created using Groove.cm
© 2023 ToBePreneur.com | All Rights Reserved.