cokePanda
|
  |
| Joined: 30 Dec 2008 |
| Total Posts: 1901 |
|
|
| 22 Jul 2014 04:58 AM |
local passId = 1214124
function Clicked() return game:GetService("GamePassService"):PlayerHasPass(player, passId) end game.Players.PlayerAdded:connect(function(plr) elseif Clicked() then script.Parent.Parent.Frame.Visible = true else script.Parent.Parent.NoPass.Visible = true end)
script.Parent.MouseButton1Down:connect(Clicked)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
What's wrong with the above?
I'm trying to: When a player clicks the imagebutton, it will check if he has a game pass, if he does, another GUI will pop up, but if he doesn't then a different GUI pops up (or one of those ROBLOX GUI's asking whether you want to purchase the game pass - if any one of you is able to make this work) |
|
|
| Report Abuse |
|
|
| |
|
cokePanda
|
  |
| Joined: 30 Dec 2008 |
| Total Posts: 1901 |
|
|
| 22 Jul 2014 05:09 AM |
11:09:18.274 - Not a valid Player 11:09:18.275 - Script 'Players.Player1.PlayerGui.Guide.ImageButton.Script', Line 4 11:09:18.277 - Stack End 11:09:18.278 - Disconnected event because of exception |
|
|
| Report Abuse |
|
|
|
| 22 Jul 2014 05:15 AM |
| player and passid not defined |
|
|
| Report Abuse |
|
|
cokePanda
|
  |
| Joined: 30 Dec 2008 |
| Total Posts: 1901 |
|
|
| 22 Jul 2014 05:26 AM |
passId is defined
And how would I define the player in this case? |
|
|
| Report Abuse |
|
|
magoo8
|
  |
| Joined: 25 Apr 2009 |
| Total Posts: 1122 |
|
|
| 22 Jul 2014 05:29 AM |
local id = IDHERE
game.Players.PlayerAdded:connect(function(plr) if game:GetService("GamepassService"):PlayerHasPass(plr, id) then script.Parent.Visible = true end) |
|
|
| Report Abuse |
|
|
cokePanda
|
  |
| Joined: 30 Dec 2008 |
| Total Posts: 1901 |
|
| |
|
|
| 22 Jul 2014 05:33 AM |
... Didn't look at the actual script. What is this even in? This would be a local script inside of a gui. Why are you using the PlayerAdded event inside of something that will replicate to all users? Define the player in the local script and remove anonymous function and it's innards. player = game.Players.LocalPlayer |
|
|
| Report Abuse |
|
|
cokePanda
|
  |
| Joined: 30 Dec 2008 |
| Total Posts: 1901 |
|
|
| 22 Jul 2014 05:36 AM |
Should it look like this?
local passId = 167686361 local player = game.Players.LocalPlayer
function Clicked() return game:GetService("GamePassService"):PlayerHasPass(player, passId) end
if Clicked() then script.Parent.Parent.Frame.Visible = true else script.Parent.Parent.NoPass.Visible = true end end)
script.Parent.MouseButton1Down:connect(Clicked) |
|
|
| Report Abuse |
|
|
|
| 22 Jul 2014 05:38 AM |
script.Parent.MouseButton1Down:connect(function() if game:GetService("GamePassService"):PlayerHasPass(game.Players.LocalPlayer, 167686361) script.Parent.Parent.Frame.Visible = true else script.Parent.Parent.NoPass.Visible = true end end) |
|
|
| Report Abuse |
|
|
cokePanda
|
  |
| Joined: 30 Dec 2008 |
| Total Posts: 1901 |
|
|
| 22 Jul 2014 05:38 AM |
| I'm still getting "Not a valid player - line 5" in the output :/ |
|
|
| Report Abuse |
|
|
cokePanda
|
  |
| Joined: 30 Dec 2008 |
| Total Posts: 1901 |
|
| |
|
cokePanda
|
  |
| Joined: 30 Dec 2008 |
| Total Posts: 1901 |
|
|
| 22 Jul 2014 05:41 AM |
if game:GetService("GamePassService"):PlayerHasPass(game.Players.LocalPlayer, 167686361) then
~~~~~~~~~~~~~
-- not a valid player. |
|
|
| Report Abuse |
|
|
cokePanda
|
  |
| Joined: 30 Dec 2008 |
| Total Posts: 1901 |
|
|
| 22 Jul 2014 05:43 AM |
| It goes down to 'else' even though I have the pass... |
|
|
| Report Abuse |
|
|
cokePanda
|
  |
| Joined: 30 Dec 2008 |
| Total Posts: 1901 |
|
| |
|