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

Help me with this gamepass GUI?

Asked by 9 years ago

I made a GUI that teleports a player that has the game pass to be telported to a certain place and if he doesnt have it it wont teleport him! Either way the player is not teleported help me please!

print("teleport")
brick = workspace["Tele3"]
player = script.Parent.Parent.Parent.Parent.Character

local passId = ########  -- Id of gamepass here!

function HasGamePass(Player)
    return game:GetService("GamePassService"):PlayerHasPass(player, PassId)
end



game.Players.PlayerAdded:connect(HasGamePass)
if HasGamePass(plr) then
    function tele()
player.Torso.CFrame = brick.CFrame + Vector3.new(0,4,0)
    end
else
    print ("Player Does not have game pass!")
end




script.Parent.MouseButton1Down:connect(tele)

2 answers

Log in to vote
0
Answered by 9 years ago

For one, "plr" is a bad parameter. So I suggest to use a different term. Maybe the id is incorrect.I'm not 100% sure but the 3rd line after character maybe it should say " = true".

Ad
Log in to vote
0
Answered by 8 years ago

This might work better.

--Make sure this is on the correct TextButton on StarterGui.

print("teleport")
brick = workspace.Tele3 --Make sure the brick is in the workspace, not in a model, and make sure the brick name is similar to the brick mentioned in the script.
player = script.Parent.Parent.Parent.Parent.Character

local passId = "PUT GAMEPASS ID HERE"  -- Id of gamepass here!

game:GetService("GamePassService"):PlayerHasPass(player, passId):connect(HasGamePass)

game.Players.PlayerAdded:connect(HasGamePass)
if HasGamePass(player) then
    function tele()
player.Torso.CFrame = brick.CFrame + Vector3.new(0,4,0)
    end
else
    print ("Player Does not have game pass!")
end


script.Parent.MouseButton1Down:connect(tele)

NOTE : This is untested. It may or may not work. Hope this helped! If it worked, please accept my answer!

Answer this question