✓ Accepted answer
There are multiple things wrong, First of all you shouldn't make this a script or a local one, What you should do is the following:
Make a Remote Event to rebirth the player, Give the Remote Event a OnServerEvent function:
(note: If you want to just copy this straight up make sure to name the remote event "RebirthEvent" and put it inside the text button with the script and the local script that fires it)
script.Parent.RebirthEvent.OnServerEvent:Connect(function()
local player = script.Parent.Parent.Parent.Parent
local rebirths = player:WaitForChild("leaderstats"):WaitForChild("Rebirths")
local clicks = player:WaitForChild("leaderstats"):WaitForChild("Clicks")
if clicks.Value >= 100 then
script.Parent.Text = "Success!"
rebirths.Value = rebirths.Value + 5
clicks.Value = 0
end
if clicks.Value < 100 then
script.Parent.Text = "Not Enough Clicks"
wait(2)
script.Parent.Text = "5 Rebirths - 100 Clicks" end
end)
Local script to fire the RemoteEvent:
script.Parent.MouseButton1Click:Connect(function()
script.Parent.RebirthEvent:FireServer()
end)
If this helped make sure to mark this answer as solution!
3 comments
Mate, it is wait(2), not wait(2.
his script doesn't work even if
it's not gonna fire correctly because it's client sided