|
| 21 Feb 2015 05:36 PM |
I want the player who has the pass be teleported to a specific point if they click the gui.
player = game.Players.LocalPlayer script.Parent.MouseButton1Click:connect(function() wait() if game:GetService("GamePassService"):PlayerHasPass(player,216568775) or player.Name == "Player" then player.Character.Torso.CFrame = CFrame.new(game.workspace.vip.teleport.Position) end end) |
|
|
| Report Abuse |
|
|
|
| 21 Feb 2015 06:00 PM |
| It only works in studio. :( |
|
|
| Report Abuse |
|
|
|
| 21 Feb 2015 06:09 PM |
just to make sure, the script has to be a local script to do game.Players.LocalPlayer
also for the or player.Name == "Player" then will only work in studio because in an actual server the names are the real names not player and player2
player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:connect(function() if game:GetService("MarketplaceService"):PlayerOwnsAsset(player, 216568775) or player.Name == "Player" then player.Character.Torso.Frame = CFrame.new(game.Workspace.vip.teleport.Position +Vector 3.new(0, 3, 0)) end end) |
|
|
| Report Abuse |
|
|
|
| 21 Feb 2015 06:12 PM |
misspelled something
do this instead
player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:connect(function() if game:GetService("MarketplaceService"):PlayerOwnsAsset(player, 216568775) or player.Name == "Player" then player.Character.Torso.CFrame = CFrame.new(game.Workspace.vip.teleport.Position +Vector 3.new(0, 3, 0)) end end) |
|
|
| Report Abuse |
|
|
|
| 21 Feb 2015 06:19 PM |
| Thank you! But how come it only works with PlayerOwnsAsset and now PlayerHasPass? |
|
|
| Report Abuse |
|
|
|
| 21 Feb 2015 06:21 PM |
Use PlayerOwnsAsset, do not use PlayerHasPass. PlayerHasPass caches, so if a player doesn't own the gamepass when they first join the server, even if they buy it while in the current game, the value is cached so the script will think they still don't own it.
PlayerOwnsAsset does not cache.
PlayerHasPass should be avoided. |
|
|
| Report Abuse |
|
|
|
| 21 Feb 2015 06:26 PM |
| Good to know, does PlayerOwnsAsset work with shirts and other items or things? |
|
|
| Report Abuse |
|
|
|
| 21 Feb 2015 06:27 PM |
| It works with most stuff, even places you've purchased access to. I'm mostly sure it's all assets. |
|
|
| Report Abuse |
|
|
|
| 21 Feb 2015 07:16 PM |
| No prob and what he said ^^^ |
|
|
| Report Abuse |
|
|