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 » Scripting Helpers
Home Search
 

Re: PLEASE HELP SMALL SCRIPT

Previous Thread :: Next Thread 
cocolouis is not online. cocolouis
Joined: 19 Nov 2011
Total Posts: 277
01 Jun 2014 06:46 PM
Can someone script this pls: "If player owns gamepass Hide the gui" I would be putting it in a script in a gui in my game. If you can pls message me it!

The gui in starter gui is named Buy VIP
Report Abuse
JimmyChance is not online. JimmyChance
Joined: 01 Nov 2009
Total Posts: 3681
01 Jun 2014 06:57 PM
local Id = 123456789 -- Id goes here.
local Gps = game:GetService("GamePassService") -- get the service.

game.Players.PlayerAdded:connect(function(p) -- anonymous function called when a player is added, then name the player instance 'p'.
p.CharacterAdded:connect(function(c) -- call our function everytime the player's character is added.
local pgui = p.PlayerGui -- get their player gui.
if pgui then
local v = pgui:FindFirstChild("Buy VIP") -- find the name of the target gui in playergui.
if not v then return end -- end function if 'Buy Vip' is nil.

if Gps:PlayerHasPass(p, Id) then -- if they have the pass
v:Destroy() -- remove it
end
end
end)
end)
Report Abuse
cocolouis is not online. cocolouis
Joined: 19 Nov 2011
Total Posts: 277
02 Jun 2014 09:35 AM
Thank you!
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
02 Jun 2014 09:41 AM
local Id = 0000000 --Put your GamePass ID here.

game.Players.PlayerAdded:connect(function(plr)
plr:WaitForDataReady()
if game:GetService('GamePassService'):PlayerHasPass(Id,plr) then
plr.CharacterAdded:connect(function(char)
plr.PlayerGui:FindFirstChild("Buy Vip"):Destroy()
end)
else end end)
Report Abuse
cocolouis is not online. cocolouis
Joined: 19 Nov 2011
Total Posts: 277
02 Jun 2014 09:47 AM
But neither of those work?????
Report Abuse
cocolouis is not online. cocolouis
Joined: 19 Nov 2011
Total Posts: 277
02 Jun 2014 09:57 AM
please someone help!
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
02 Jun 2014 10:03 AM
Maybe the script is running the CharacterAdded event no matter what bool the if statement returns, try this;

ID = 0000000

game.Players.PlayerAdded:connect(function(plr)
plr.CharacterAdded:connect(function(char)
if game:GetService('GamePassService'):PlayerHasPass(plr,ID) then
plr.PlayerGui:FindFirstChild("Buy Vip"):Destroy()
end end) end)
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
02 Jun 2014 10:09 AM
plr:WaitForChild ("PlayerGui")

In case its not loaded
Report Abuse
cocolouis is not online. cocolouis
Joined: 19 Nov 2011
Total Posts: 277
02 Jun 2014 03:55 PM
@Island do I put that at the top?
Report Abuse
cocolouis is not online. cocolouis
Joined: 19 Nov 2011
Total Posts: 277
02 Jun 2014 03:59 PM
its not working guys! Pls someone help I just need it to make you buy a Gamepass or you cant get in game
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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