Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

[REPOSTED] Why wont this rebirth script not work? [closed]

Asked by 6 years ago

    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.

0
Your problem on line 6 persists. User#19524 175 — 6y

Marked as Duplicate by User#19524

This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here.

Why was this question closed?