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!
01 | print ( "teleport" ) |
02 | brick = workspace [ "Tele3" ] |
03 | player = script.Parent.Parent.Parent.Parent.Character |
04 |
05 | local passId = ######## -- Id of gamepass here! |
06 |
07 | function HasGamePass(Player) |
08 | return game:GetService( "GamePassService" ):PlayerHasPass(player, PassId) |
09 | end |
10 |
11 |
12 |
13 | game.Players.PlayerAdded:connect(HasGamePass) |
14 | if HasGamePass(plr) then |
15 | function tele() |
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".
This might work better.
01 | --Make sure this is on the correct TextButton on StarterGui. |
02 |
03 | print ( "teleport" ) |
04 | brick = workspace.Tele 3 --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. |
05 | player = script.Parent.Parent.Parent.Parent.Character |
06 |
07 | local passId = "PUT GAMEPASS ID HERE" -- Id of gamepass here! |
08 |
09 | game:GetService( "GamePassService" ):PlayerHasPass(player, passId):connect(HasGamePass) |
10 |
11 | game.Players.PlayerAdded:connect(HasGamePass) |
12 | if HasGamePass(player) then |
13 | function tele() |
14 | player.Torso.CFrame = brick.CFrame + Vector 3. new( 0 , 4 , 0 ) |
15 | end |
NOTE : This is untested. It may or may not work. Hope this helped! If it worked, please accept my answer!