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

Insert a Grow Limit inside this script?

Asked by 4 years ago

Sorry for Bad English

Hi, i need to insert a grow limit, but how i can do it? I need people can increase the bodysize in scale for how much power he has. For Example -> 3000 Power is the max for a guy with 0 Rebirths. He can make other Power, but all statistics not increase, bodysize too. If this Guy do the first rebirth, the max power is 3500 of BodyScale and statistics 2 Rebirth -> 4000 Etc...

How i can do it?

local replicatedStorage = game:GetService("ReplicatedStorage")
local remoteData = game:GetService("ServerStorage"):WaitForChild("RemoteData")
local starterRebirthAmount = 100

local cooldown = 1

replicatedStorage.Remotes.Lift.OnServerEvent:Connect(function(player)

    if not remoteData:FindFirstChild(player.Name) then return "NoFolder" end

    local debounce = remoteData[player.Name].Debounce

    if not debounce.Value then

        debounce.Value = true

        player.leaderstats.Power.Value = player.leaderstats.Power.Value + 1 * (player.leaderstats.Rebirths.Value + 1)

        player.leaderstats.Money.Value = player.leaderstats.Money.Value + math.random(1,4) * (player.leaderstats.Rebirths.Value + 1)

        wait(cooldown)

        debounce.Value = false
    else

    end

end)

replicatedStorage.Remotes.Rebirth.OnServerInvoke = function(player)

    if not remoteData:FindFirstChild(player.Name) then return "NoFolder" end

    local rebirths = player.leaderstats.Rebirths

    if player.leaderstats.Power.Value >= (math.floor((starterRebirthAmount + (rebirths.Value) * math.sqrt(200)))) then

        rebirths.Value = rebirths.Value + 1

        player.leaderstats.Power.Value = 0

        player:LoadCharacter()

        return true
    else return "NotEnoughPower"


    end
end

Answer this question