generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Why wont this work?

Previous Thread :: Next Thread 
ThisUserSecret is not online. ThisUserSecret
Joined: 29 Sep 2012
Total Posts: 1094
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
ThisUserSecret is not online. ThisUserSecret
Joined: 29 Sep 2012
Total Posts: 1094
21 Feb 2015 06:00 PM
It only works in studio. :(
Report Abuse
bojigglesmister2 is not online. bojigglesmister2
Joined: 26 Jun 2011
Total Posts: 1421
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
bojigglesmister2 is not online. bojigglesmister2
Joined: 26 Jun 2011
Total Posts: 1421
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
ThisUserSecret is not online. ThisUserSecret
Joined: 29 Sep 2012
Total Posts: 1094
21 Feb 2015 06:19 PM
Thank you! But how come it only works with PlayerOwnsAsset and now PlayerHasPass?
Report Abuse
ChiefDelta is not online. ChiefDelta
Joined: 05 Nov 2010
Total Posts: 13071
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
ThisUserSecret is not online. ThisUserSecret
Joined: 29 Sep 2012
Total Posts: 1094
21 Feb 2015 06:26 PM
Good to know, does PlayerOwnsAsset work with shirts and other items or things?
Report Abuse
ChiefDelta is not online. ChiefDelta
Joined: 05 Nov 2010
Total Posts: 13071
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
bojigglesmister2 is not online. bojigglesmister2
Joined: 26 Jun 2011
Total Posts: 1421
21 Feb 2015 07:16 PM
No prob and what he said ^^^
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image