Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can You Make A Gamepass To Allow You When You Press The Teleport Gui It Teleports You?

Asked by 4 years ago
Edited 4 years ago

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)
0
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 oOmekooOo 0 — 4y
0
yes you can oOmekooOo 0 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Try using game:GetService("MarketplaceService"):PlayerOwnsAsset(idhere)

and if its nil it wont let them teleport

Ad

Answer this question