I am making a team changer and I want the “SWAT” team to be locked for a gamepass. Although when I click on it, the gamepass technically initiates, but it tells me there was an error.
Local script inside of the button:
local RemoteEvent = game.ReplicatedStorage.TeamChange
local frame = game.Players.LocalPlayer.PlayerGui:WaitForChild("MainMenu").Frame.TeamsFrame.TeamsLayout
local Player = game.Players.LocalPlayer
local SWATColor = "Navy blue"
local SWATpass = 7844798914
local MarketPlaceService = game:GetService("MarketplaceService")
frame.SWAT.MouseButton1Click:Connect(function()
if MarketPlaceService:UserOwnsGamePassAsync(Player.UserId, SWATpass) then
print(Player.Name.." owns the SWAT pass")
RemoteEvent:FireServer(BrickColor.new(SWATColor))
else
MarketPlaceService:PromptGamePassPurchase(Player, 7844798914)
MarketPlaceService.PromptGamePassPurchaseFinished:Connect(function(player, swatPass, wasPurchased)
if wasPurchased then
RemoteEvent:FireServer(BrickColor.new(SWATColor))
else
print(Player.Name.." declined the SWAT pass purchase.")
return
end
end)
end
end)
Can anybody help?
. I changed it and it works perfectly now! Thank you!