Would this 2x Gamepass script double all points?

Hey! I found this 2x Gamepass script on Youtube earlier. It works, but I have a question about it. Will it double all points, including a daily reward? If so, is there a way to make it double only points you get from winning? Here is the script:

game.Players.PlayerAdded:Connect(function(player)
wait(5)
	local marketservice = game:GetService("MarketplaceService")

	local can = true
	repeat wait() until player:FindFirstChild("leaderstats")
	local leader = player:FindFirstChild("leaderstats")
	if leader then
		repeat wait() until leader:FindFirstChild(script:WaitForChild("Currency").Value)
		local currency = leader:FindFirstChild(script:WaitForChild("Currency").Value)
		if currency then
			local folder = Instance.new("Folder",player)
			folder.Name = "2xGamepass"
			local oldmoney = Instance.new("IntValue",folder)
			oldmoney.Name = "OldMoney"
			oldmoney.Value = currency.Value
			local give2x = Instance.new("IntValue",folder)
			give2x.Name = "Give2x"
			give2x.Value = 0

			currency.Changed:Connect(function()
				if marketservice:UserOwnsGamePassAsync(player.UserId, script:WaitForChild("GamepassId").Value) then


					if can == true then
						can = false
						if currency.Value > oldmoney.Value then
							give2x.Value = currency.Value - oldmoney.Value

							currency.Value = currency.Value + give2x.Value

							oldmoney.Value = currency.Value
							can = true
						else

							oldmoney.Value = currency.Value
							can = true


						end

					end
				else
					oldmoney.Value = currency.Value
				end
			end)

		end
	end
end)
1 Like

Just a side note, but it shouldn’t be necessary to use repeat wait() loops inside your script to check if a thing exists, use WaitForChild() instead

Honestly the script confuses me a bit, especially this:

local currency = leader:FindFirstChild(script:WaitForChild("Currency").Value)
--Passing through more lines...
						if currency.Value > oldmoney.Value then

You’re literally trying to find a Value property inside another Value property what

are the leaderstats implemented in a different script btw?

1 Like

Yes the leaderstats are in another script.

I forgot this existed whoops

Hm alrighty, I’ll attempt to rewrite your code to see if it’ll change anything hopefully?

local MarketService = game:GetService("MarketplaceService")

game.Players.PlayerAdded:Connect(function(Player)
    local can = true
    local leaderstats = player:WaitForChild("leaderstats")
    local Currency = leaderstats:WaitForChild("Currency")

    local folder = Instance.new("Folder")
	folder.Name = "2xGamepass"
    folderParent = Player

	local oldmoney = Instance.new("IntValue")
	oldmoney.Name = "OldMoney"
	oldmoney.Value = currency.Value
    oldmoney.Parent = Folder

	local give2x = Instance.new("IntValue")
	give2x.Name = "Give2x"
	give2x.Value = 0
    give2x.Parent = Folder

    Currency.Changed:Connect(function()
        if MarketService:UserOwnsGamePassAsync(Player.UserId, script.GamepassId.Value) then
			if can == true then
				can = false
				if currency.Value > oldmoney.Value then
					give2x.Value = currency.Value - oldmoney.Value
					currency.Value = currency.Value + give2x.Value
					oldmoney.Value = currency.Value
					can = true
				else
					oldmoney.Value = currency.Value
					can = true
				end
			end
		else
			oldmoney.Value = currency.Value
		end
	end)
end)
1 Like