The script below is a script that basically takes the Rebirth Remote Event and resets the Strength Value to zero, adds another rebirth to your stats, etc.
replicatedStorage.Remotes.Rebirth.OnServerInvoke = function(player)
if not remoteData:FindFirstChild(player.Name) then return "NoFolder" end
local rebirths = player.leaderstats.Rebirths
if player.leaderstats.Strength.Value >= (math.floor((starterRebirthRequirement + (rebirths.Value) * math.sqrt(5000000)))) then
rebirths.Value = rebirths.Value + 1
player.leaderstats.Strength.Value = 0
--delete tool from backpack--
local Tool = player.Backpack:FindFirstChild("MrJohnsen")
if Tool then
Tool:Destroy()
end
Tool = player.Backpack:FindFirstChild("DroolingJohnsen")
if Tool then
Tool:Destroy()
end
local Tool = player.Backpack:FindFirstChild("ZombieJohnsen")
if Tool then
Tool:Destroy()
end
Tool = player.Backpack:FindFirstChild("NoobJohnsen")
if Tool then
Tool:Destroy()
end
local Tool = player.Backpack:FindFirstChild("LilJohnsen")
if Tool then
Tool:Destroy()
end
Tool = player.Backpack:FindFirstChild("FrozenJohnsen")
if Tool then
Tool:Destroy()
end
Tool = player.Backpack:FindFirstChild("RiceFieldJohnsen")
if Tool then
Tool:Destroy()
end
Tool = player.Backpack:FindFirstChild("GlowingJohnsen")
if Tool then
Tool:Destroy()
end
Tool = player.Backpack:FindFirstChild("TrapJohnsen")
if Tool then
Tool:Destroy()
end
Tool = player.Backpack:FindFirstChild("Doge")
if Tool then
Tool:Destroy()
end
Tool = player.Backpack:FindFirstChild("BananaJohnsen")
if Tool then
Tool:Destroy()
end
Tool = player.Backpack:FindFirstChild("Speedwagon")
if Tool then
Tool:Destroy()
end
player.StarterGear:ClearAllChildren()
player:LoadCharacter()
game.ReplicatedStorage.HeadsTools.MrJohnsen:Clone().Parent = player.Backpack
game.ReplicatedStorage.HeadsTools.MrJohnsen:Clone().Parent = player.StarterGear
if rebirths.Value >= 1 and rebirths.Value < 5 then
game.ReplicatedStorage.RebirthHeads.RebirthJohnsen.Clone().Parent = player.Backpack
game.ReplicatedStorage.RebirthHeads.RebirthJohnsen.Clone().Parent = player.StarterGear
end
return true
else return "NotEnoughStrength"
end
end
Although I have enough strength, the game still thinks I don’t have enough. I also don’t see any problems that show up in output. What is wrong with the script?