I've been coding a gamepass button on my game, but i can't find a way to fix the syntax errors as i am a new coder. can somebody please help with the syntax errors?
local button = script.Parent
local function onButtonActivated(local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local gamePassID = 22453139
s
local function promptPurchase()
local player = Players.LocalPlayer
local hasPass = false
local success, message = protocall(function()
hasPass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, gamePassID)
end)
if not success then
warn("Error while checking if player has pass: " .. tostring(message))
return
end
if hasPass then message (You already own this pass)
else
MarketplaceService:PromptGamePassPurchase(player, gamePassID)
end
end)
print("Button activated!")
end
button.Activated:Connect(onButtonActivated)

1 comment
I have found a few fixes to my own code, such as ("You already own this pass") instead of the one missing the parenthasis