How would I go on making a gui when clicked it saves I know how to do the mouse detection but how do make it when they click it saves there spawn point where ever they currently are and when they die they spawn at that location. Also I’m not talking about those obby checkpoints with requiring the player to switch teams I want it to save the player’s location without doing that.
Whenever the player clicks said button, fire a remote event. Listen for the event on a server side script, and assign a variable as the player’s current location. Whenever the player spawns again, set their position to that saved value. Hope this helps!
I’m not too familiar with remote events could you further explain and show me an example.
Read about Remote Calling here, more specifically, Remote Events here.
In the server script, I would recommend have a global table within it. Each time a player joins, create a new index within the table for that player. Said index could be the player’s name or
UserId. Whenever the player fires the
RemoteEvent, set the value of the player’s spawn location within the table to their current location. This could be via
Position. Add a
CharacterAdded event within the function that is connect to when a new player joins. Within that new function, check if the player has a stored locational value, and if they do, teleport them to that location.
I am not going to write out a script for you, so I hope you understand the basics of scripting. If not, the provided links are very useful and should help you out. Good luck!
Okay .I have been scripting for 7 months and there is too much to learn .I Wish Roblox would just simplify Lua .I want to give up. If I get one error in the output I quit.
Use a clicked event to wait for GUI event then get the position of the players torso or humanoid root part and save that data somewhere and use player.onappearanceloaded to check when player respawns then set to The players position to the data saved. Sorry for my lack of explanation I am on my phone.
So I make a leaderboard and check for that value and save to make sure the player is in the exact same location using HumanoidRootPart.CFrame
Making a server-sided script isn’t necessary, unless you have anti-cheat preventing teleportation.
Therefore, you can assign the player’s current CFrame to a variable in the same script as you would detect the button. From there you could detect when the player clicks the button and set its CFrame to that variable on respawn.
Okay this is starting to make sense
Well got this so far but what do I do next local spawn = script.Parent
You can’t assign a function to a variable, you will need to do the mouse button one function and set the spawn variable inside that function to the player’s location at the time of clicking it.
No I did in multiple lines of the code I did not assign the mouse click as a variable.What I want to know is what do next
okay so I’m thinking of this I’m thinking a checkpoint is like a reverse teleport what I would have to do is make a value and check for that value at the beginning of the game teleport the player to that location.