Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Script that multiplies leaderstats by 2?

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

✓ Accepted answer

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)


2 comments

0

Thank you! This helped alot!

0

@TheRobloxGamerYTy Since it helped you would you want to accept my answer so we both get credit points at this site?

This discussion is preserved as it was. New answers, comments, and votes are closed.