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 |
|
|
|
| 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
|
  |
| Joined: 19 Nov 2011 |
| Total Posts: 277 |
|
| |
|
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
|
  |
| Joined: 19 Nov 2011 |
| Total Posts: 277 |
|
|
| 02 Jun 2014 09:47 AM |
| But neither of those work????? |
|
|
| Report Abuse |
|
|
cocolouis
|
  |
| Joined: 19 Nov 2011 |
| Total Posts: 277 |
|
| |
|
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 |
|
|
|
| 02 Jun 2014 10:09 AM |
plr:WaitForChild ("PlayerGui")
In case its not loaded |
|
|
| Report Abuse |
|
|
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
|
  |
| 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 |
|
|