I’ve been searching for ways to script a Reset Stage Button for my obby game and I came across another DevForum topic and it’s the only one I think that matches my obby layout.
I looked through the post and they explained it very well. I thought this would actually work. I put the Remote Event in ReplicatedStorage, I put the code into the Local Script and I was confused at first I didn’t know what the solver meant by, "on your your local script put
game.ReplicatedStorage.ResetStage:FireServer(clicked) "
I didn’t know where to put it in the local script though, so I put it into the original local script that they had. But the ServerScriptService script seemed right. I ran the game, clicked yes, and in the output it said
[Attempts is not a valid member of Folder].
The Stage Value changed to 1, but it didn’t reset me or teleport me to stage 1. I tried to manually reset, but i just stayed on the same stage
How can I fix this.
Sorry if I can’t be specific.This is my first DevForum post.
Also so as said before in the other post firing a remote event is basically sending information to the server from a local script that you cannot get in a script. So you are sending the clicked variable to the server so the server can receive it.
What it means by attemps is you did not set attemps to be a leaderstats value. So you need to set a value you you did with stage with the leaderstats folder. So after you get the leaderstats folder you do.
local Attemps = Instance.new("IntValue")
Attemps.Parent = clicked.leaderstats
Now what will happen is It’ll make a IntValue set like you have for stage and you have to change it on the server because it will only save or store your values on the server. You are getting clicked from the localscript since You cannot get the local player from the server.
Alright so then what you want to do is set the Attempts on player joined so run a game.Players.PlayerAdded:Connect(function(plr) and then write the code under there.
If you use teams and spawn locations to handle it, then I think you could just get away with a LoadCharacter event.
If not, if you have a table of parts or positions for the stages, you could load their character then CFrame them to the position or just teleport them there.