I have been trying to figure out how to create a rebirth button that resets the user’s stage and also adds +1 to their rebirth leaderstats. I cannot figure out where to start when creating this at all. I have viewed tutorials, but none of them are really working. Could someone help me with any assistance?
1 Like
local Players = game:GetService("Players")
local function Rebirth(Player)
Player.leaderstats.stage = 0 -- Resets The Player Stage
Player.leaderstats.Rebirth += 1 -- Increment The Player Rebirth By 1
end
RebirthButton.Touched:Connect(function(hit)
local Character = hit.Parent
if Character and Character:FindFirstChild("Humanoid") then -- Checks If Character Exist To Prevent Errors
local Player :Player = Players:GetPlayerFromCharacter(Character) -- Gets The Player
Rebirth(Player) -- Call The Rebirth Function
end
end)
you can use something similar to this
- 1- get the Player when he touches a part
- 2- Reset His Stage Value To 0 and increment his Rebirth Value by 1
- 3- that is all
1 Like