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

Script that multiplies leaderstats by 2?

Asked by 3 years ago

Me and my friend are working on a game about collecting deaths When you die your leaderstat goes up We want it so when you buy a gamepass it multiplys ur deaths by 2 Here is our leaderstats code

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(char)

        char.Humanoid.Died:connect(function()
            player.leaderstats.Deaths.Value = player.leaderstats.Deaths.Value +1

        end)
    end)
end)


Please help! Thanks Cameron

1 answer

Log in to vote
0
Answered by 3 years ago

Hello, Cameron. I wish you luck with your new game!

This script will basically just add the normal +1 which you already have and then if a player has the gamepass he will get an extra +1 to keep it simple!

local MPS = game:GetService("MarketplaceService")

local YourGamepassID = 0000000

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

    player.CharacterAdded:connect(function(char)

        char.Humanoid.Died:connect(function()
            player.leaderstats.Deaths.Value = player.leaderstats.Deaths.Value +1

            if MPS:UserOwnsGamePassAsync(player.UserId, YourGamepassID) then

                player.leaderstats.Deaths.Value = player.leaderstats.Deaths.Value + 1
            end

        end)
    end)
end)


0
Thank you! This helped alot! TheRobloxGamerYTy 2 — 3y
0
@TheRobloxGamerYTy Since it helped you would you want to accept my answer so we both get credit points at this site? johnoscarbhv1 137 — 3y
Ad

Answer this question