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

Why my rebirth doesn't give me bonus points per click?

Asked by 4 years ago
Edited 4 years ago
local repStorage = game:GetService("ReplicatedStorage")
local remote = repStorage:FindFirstChild("RebirthClick")

remote.OnServerEvent:Connect(function(plr, x)
     if plr.leaderstats.Points.Value >= 100 * (x.Value + 1) then             
        x.Value = x.Value + 1
        plr.leaderstats.Points.Value =  0      
    end
end)

Rebirth System

local repStorage = game:GetService("ReplicatedStorage")
local remote = repStorage:FindFirstChild("RebirthClick")

local button = script.Parent

local debounce = false

button.MouseButton1Click:Connect(function()
    local rebirths = game.Players.LocalPlayer.leaderstats:FindFirstChild("Rebirths")
    if not debounce then
        debounce = true
        local playerPoint = rebirths
        remote:FireServer(playerPoint)
        wait(0.01)
        debounce = false
    end
end)

repeat
    local rebirths = game.Players.LocalPlayer.leaderstats:FindFirstChild("Rebirths")         
    local textButton = script.Parent
    textButton.Text = "Rebirth: ".. tostring(100 * (rebirths.Value + 1)) .." cash required"
    wait(0.01)
until script.Parent == nil

My PointButton - local script

Answer this question