A Gamepass That When You Bought It Then It Allows You When You Press The Teleport Gui Then It Teleports You Functionally But When It's Not Bought Then The Teleport Will Not Work
Here Is My Code:
disabled = false
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
if game.MarketplaceService:PlayerOwnsAsset(player,11274115) then
script.Parent.MouseButton1Click:connect(function()
if disabled == false then
disabled = true
end
script.Parent.BackgroundColor3 = Color3.new(217, 0, 0)
game.Workspace.Teleport.RemoteFunction:InvokeServer()
wait(3)
script.Parent.BackgroundColor3 = Color3.new(0, 154, 0)
disabled = false
end)
function onKeyPress(inputObject, gameProcessedEvent)
if inputObject.KeyCode == Enum.KeyCode.Q then
if disabled == false then
disabled = true
end
script.Parent.BackgroundColor3 = Color3.new(217, 0, 0)
game.Workspace.Teleport.RemoteFunction:InvokeServer()
wait(3)
script.Parent.BackgroundColor3 = Color3.new(0, 154, 0)
disabled = false
game:GetService("UserInputService").InputBegan:connect(onKeyPress)

2 comments
on line 6 when you start the if statement, it ends at line 8, meaning all the code below it will run regardless of weather disabled is false
yes you can