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

Doesnt Sell x2 When Player Has Game Pass?

So I spent a while writing this script and it hasnt worked. I have a gamepass and a sell block, when you touch the block, I want the currency "Jump" to be converted into "Bills", (say you have 50 Jump, and you touch the block, you will then have 0 Jump and 50 Bills) and if the player has a gamepass then I want them to get 2x the origanl amount, e.g if the player doesnt not have the gamepass then they will get 50 Bills, and if they do have the gamepass, then they will get 100 Bills. Thank you! (Please help I spent ages on the script) ????

Script:

local debounce = true

script.Parent.Touched:Connect(function(partThatTouched)
    local humanoid = partThatTouched.Parent:FindFirstChildWhichIsA("Humanoid") --Humanoid
    if humanoid then
        local player = game.Players:FindFirstChild(partThatTouched.Parent.Name) --Finds player
        local PlrStatsJump = player.leaderstats:FindFirstChild("Jump")
		local PlrStatsBills = player.leaderstats:FindFirstChild("Bills")
        if debounce then
			local id = 7549267
			local plr = game.Players.LocalPlayer
			if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(plr, id) then
            	debounce = false
				PlrStatsBills.Value = PlrStatsBills.Value + PlrStatsJump.Value + PlrStatsJump.Value
				wait()
				PlrStatsJump.Value = 0
           		wait (2)
            	debounce = true
			else
				debounce = false
				PlrStatsBills.Value = PlrStatsBills.Value + PlrStatsJump.Value
				wait()
				PlrStatsJump.Value = 0
           		wait (2)
            	debounce = true
			end
        end
    end 
end)

4 comments

0

Are you sure you own the gamepass?

0

if you'd scroll down just a little bit you would realise that this question is already answered

0

Yeah but that wasn't really an answe was it? Do you still want help or no? Im not looking for reputation points

0

It says the question is answered with the check on the right, no i dont need any more help.

1 answer

✓ Accepted answer

I suggest instead of adding them together twice just multiply them by 2, e.g

if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(plr, id) then
                debounce = false
                PlrStatsBills.Value = PlrStatsBills.Value + PlrStatsJump.Value * 2
                wait()
                PlrStatsJump.Value = 0
                wait (2)
                debounce = true

6 comments

0

That doesnt help at all and it doesnt relate to my quesiton at all but ok?

0

k I'm sorry I attempted at helping you, maybe if you had described your problem better I would have been able to help, no need to be rude

0

I’m not being rude, and I described it in a whole paragraph, sorry if you took it iN that I was being rude I wasn’t trying to

0

" it doesnt relate to my quesiton at all but ok?" sounds passive agressive but i hope u get ur porblem fixed

0

ok thanks\

0

but yeah sorry i didnt mean to sound passive agressive or anything. I just mean to say it didnt really help. But thanks anyways!

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