local repStore = game:GetService("ReplicatedStorage")
	local remote1 = repStore.RemoteFolder:WaitForChild("Rebirth")
	                ----- Rebirth Events----
	remote1.OnServerEvent:connect(function(plr, uniquekey1)
	    if uniquekey1 ~= script.Key1.Value then return end
	    if plr.leaderstats.Money.Value <= 50000 then
	    wait(1)
	    print(plr.Name.."doesn't have enough to Rebirth.")
	    else
	        if plr.leaderstats.Money.Value >= 50000 then
	            wait(1)
	            plr.leaderstats.Money.Value = 0
	            plr.leaderstats.Rebirths.Value = plr.leaderstats.Rebirths.Value + 1
	        end
	    end
	end)  

I was told that I should probably switch around a couple events to make my game more secure. Can someone please answer on how I should do this? And why when the player rebirths why the player gets more than one rebirth.

	local repStore = game:GetService("ReplicatedStorage")
	local remote1 = repStore.RemoteFolder:WaitForChild("Rebirth")
	local plr = game.Players.LocalPlayer
	 
	script.Parent.MouseButton1Click:connect(function()
	    if plr.leaderstats.Money.Value < 50000 then
	    script.Parent.Text = "Need More Money"
	    script.Parent.Selectable = false
	    wait(1)
	    script.Parent.Selectable = true
	    script.Parent.Text = "Rebirth!"
	else	
	    if plr.leaderstats.Money.Value >= 50000 then
	    script.Parent.Text = "Success, Processing your Rebirth!"
	    script.Parent.Visible = false
	    wait(1)
	    script.Parent.Text = "Rebirth!"
    script.Parent.Visible = true
    wait(.1)
	    remote1:FireServer("3pE3A")
	end
	end
	end)

First is in ServerScriptService Second is in StarterGui The rebirth gives you multiple rebirths instead of only one.

1 comment

0

Your problem on line 6 persists.