I want when the gamepass is bought you are then able to click the button and it fires the server however, when i click the button it just tells me that I already own this item and i have not been charged and then it doesnt do anything after here is my script :
local cas = game:GetService("ContextActionService")
local rs = game:GetService("ReplicatedStorage")
local mps = game:GetService("MarketplaceService")
local product = 186581274
local events = rs:WaitForChild("Events")
local BallerEvent = events:WaitForChild("Baller")
local uis = game:GetService("UserInputService")
local button = script.Parent.BallerButton
local plr = game.Players.LocalPlayer
local character = plr.Character or plr.CharacterAdded:Wait()
local hum = character:WaitForChild("Humanoid")
local animator = hum:WaitForChild("Animator")
local waittime = 10
local BallAnim = animator:LoadAnimation(script:WaitForChild("Animation"))
local debounce = false
local function Baller()
if debounce == true then
return
elseif debounce == false then
local clone = game.Workspace.Basket:Clone()
BallerEvent:FireServer(character)
BallAnim:Play()
debounce = true
wait(waittime)
debounce = false
end
end
button.MouseButton1Click:Connect(function(plr)
if mps:PlayerOwnsAsset(game.Players.LocalPlayer,product) == true then
Baller()
button.Active = false
wait(waittime)
button.Active = true
else
mps:PromptGamePassPurchase(game.Players.LocalPlayer,product)
end
end)
mps.PromptGamePassPurchaseFinished:Connect(function(player, pass_id, was_purchased)
if product == pass_id and was_purchased then
game.Workspace.Bought:Play()
end
end)
help would be appreciated