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)
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