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

Why does my auto leaderstat giver in server script service not work anymore?

Asked by
Nozazxe 107
3 years ago
Edited 3 years ago
game.Players.PlayerAdded:Connect(function(player)

    repeat wait(1) until game:IsLoaded()

    local prodVal = player.leaderstats.Production
    local coinVal = player.leaderstats["Ro-Coin"]
    local MPS = game:GetService("MarketplaceService")
    local id = 19564558

    while true do
        if MPS:UserOwnsGamePassAsync(player.UserId, id) or player.Name == "Apples002" or player.Name == "deatnumber61" or player.Name == "Nozazxe" or player.MembershipType == Enum.MembershipType.Premium then
        wait(2.5)
            coinVal.Value = coinVal.Value + prodVal.Value
        else
            if not MPS:UserOwnsGamePassAsync(player.UserId, id) then
            wait(5)
                coinVal.Value = coinVal.Value + prodVal.Value
            end
        end
    end
end)

I dont get any error or warning in the output. my game has suddenly stopped working cause of this, can someone help?

0
Is there any errors or warnings in the output? rayhansatria 142 — 3y

2 answers

Log in to vote
0
Answered by 3 years ago

Why are you putting that in a while true do loop without any cooldowns? Try while wait() do.

game.Players.PlayerAdded:Connect(function(player)

    repeat wait(1) until game:IsLoaded()

    local prodVal = player.leaderstats.Production
    local coinVal = player.leaderstats["Ro-Coin"]
    local MPS = game:GetService("MarketplaceService")
    local id = 19564558

    while wait() do
        if MPS:UserOwnsGamePassAsync(player.UserId, id) or player.Name == "Apples002" or player.Name == "deatnumber61" or player.Name == "Nozazxe" or player.MembershipType == Enum.MembershipType.Premium then
        wait(2.5)
            coinVal.Value = coinVal.Value + prodVal.Value
        else
            if not MPS:UserOwnsGamePassAsync(player.UserId, id) then
            wait(5)
                coinVal.Value = coinVal.Value + prodVal.Value
            end
        end
    end
end)
0
It still does not work. And, i dont get any error in the output either. Nozazxe 107 — 3y
0
It still does not work. And, i dont get any error in the output either. Nozazxe 107 — 3y
Ad
Log in to vote
0
Answered by
Nozazxe 107
3 years ago

solved this myself by removing the or arguement and making it its own if statement

Answer this question