local gamepass = 5620181 local service = game:GetService("MarketplaceService") script.Parent.MouseButton1Click:connect(function() if service:PlayerOwnsAsset(gamepass) then if script.Parent.Parent.Parent.TeleportGui.Enabled == false then script.Parent.Parent.Parent.TeleportGui.Enabled = true else script.Parent.Parent.Parent.TeleportGui.Enabled = false end end end)
It's supposed to open a gui if the player owns the gamepass.
EDIT: Figured out that a few things had been changed. There's now no error whatsoever, but nothing happens when clicking the button
Here's the new script:
local passid = 5620181 local service = game:GetService("MarketplaceService") script.Parent.MouseButton1Click:connect(function() if service:UserOwnsGamePassAsync(game.Players.LocalPlayer.UserId, passid) then if script.Parent.Parent.Parent.TeleportGui.Enabled == false then script.Parent.Parent.Parent.TeleportGui.Enabled = true else script.Parent.Parent.Parent.TeleportGui.Enabled = false end end end)
Use a localscript and this script instead:
local gamepass = 5620181 local service = game:GetService("MarketplaceService") script.Parent.MouseButton1Click:connect(function() if service:PlayerOwnsAsset(game.Players.LocalPlayer,gamepass) then if script.Parent.Parent.Parent.TeleportGui.Enabled == false then script.Parent.Parent.Parent.TeleportGui.Enabled = true else script.Parent.Parent.Parent.TeleportGui.Enabled = false end end end)