-
What do you want to achieve? a working gamepass button
-
What is the issue? it doesnt work, no errors or anything
-
What solutions have you tried so far? i looked for ‘fixed’ versions, tried modifying the code, nothing works
this is the code the tycoon uses for it
v.Head.Touched:connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if v.Head.CanCollide == true then
if player ~= nil then
if script.Parent.Owner.Value == player then
if hit.Parent:FindFirstChild("Humanoid") then
if hit.Parent.Humanoid.Health > 0 then
local PlayerStats = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
if PlayerStats ~= nil then
if (v:FindFirstChild('Gamepass')) and (v.Gamepass.Value >= 1) then
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.userId, v.Gamepass.Value) then
Purchase({[1] = v.Price.Value,[2] = v,[3] = PlayerStats})
else
game:GetService("MarketplaceService"):PromptGamePassPurchase(player, v.Gamepass.Value)
end
elseif (v:FindFirstChild('DevProduct')) and (v.DevProduct.Value >= 1) then
game:GetService('MarketplaceService'):PromptProductPurchase(player,v.DevProduct.Value)
elseif PlayerStats.Value >= v.Price.Value then
Purchase({[1] = v.Price.Value,[2] = v,[3] = PlayerStats})
Sound(v, Settings.Sounds.Purchase)
else
Sound(v, Settings.Sounds.ErrorBuy)
end
end
end
end
end
end
end
end)
end
end)
end