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

Doesnt Sell x2 When Player Has Game Pass?

Asked by
Rynappel 212 Moderation Voter
4 years ago

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)
0
Are you sure you own the gamepass? Spjureeedd 385 — 4y
0
if you'd scroll down just a little bit you would realise that this question is already answered Rynappel 212 — 4y
0
Yeah but that wasn't really an answe was it? Do you still want help or no? Im not looking for reputation points Spjureeedd 385 — 4y
0
It says the question is answered with the check on the right, no i dont need any more help. Rynappel 212 — 4y

1 answer

Log in to vote
1
Answered by
zomspi 541 Moderation Voter
4 years ago

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
0
That doesnt help at all and it doesnt relate to my quesiton at all but ok? Rynappel 212 — 4y
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 zomspi 541 — 4y
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 Rynappel 212 — 4y
0
" it doesnt relate to my quesiton at all but ok?" sounds passive agressive but i hope u get ur porblem fixed royaltoe 5144 — 4y
View all comments (2 more)
0
ok thanks\ Rynappel 212 — 4y
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! Rynappel 212 — 4y
Ad

Answer this question