✓ Accepted answer
Inside your button you press to reset the stage, inset a local script and insert this into it
player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
script.Parent.RemoteEvent:FireServer(player)
end)
All this does is tell the server the event has been fired
Also insert a normal script into the button, and insert a RemoteEvent, and then use this code in the normal script
RemoteEvent = script.Parent.RemoteEvent
player = script.Parent.Parent.Parent.Parent
RemoteEvent.OnServerEvent:Connect(function()
player.leaderstats.Stage.Value = 0
end)
This tells the event what to do, and in this case it resets the stage to 0. The event makes it so that the change is seen both on the server and the client.
3 comments
This won't work if you're doing it in a localscript due to filteringenabled, try firing a remote event to the server to let it know that you want to reset your stage
First, you can't call LocalPlayer with a sever script. And second, you will need a local script, and a function that fires the server to change the value.
Yup