|
| 16 Feb 2014 12:48 PM |
The script is meant to change the Visibility of an item inside the gui when the gui gets clicked. Currently it isn't working as the item inside the gui remains visible to all. Am I doing something wrong or does roblox just hate me?
allowed = {"MarsPwnsAll","deathdoor95"} rrr = Player.PlayerGui.MainGUI.Characters['1'].Characters1.Lucemon
function pie() Game:GetService("Players").PlayerAdded:connect(function(Player) for i = 1,#allowed do if Player.Name == allowed[i] then rrr.Visible = true elseif Player.Name ~= allowed then rrr.Visible = false end end end) end
script.Parent.MouseButton1Click:connect(pie)
|
|
|
| Report Abuse |
|
|
iIikeyou
|
  |
| Joined: 07 Mar 2012 |
| Total Posts: 1659 |
|
|
| 16 Feb 2014 12:51 PM |
allowed = {"MarsPwnsAll","deathdoor95"} rrr = Player.PlayerGui.MainGUI.Characters['1'].Characters1.Lucemon for _,v in ipairs(allowed)do allowed[v]=true end function pie() rrr.Visible = allowed[game.Players.LocalPlayer.Name] end
script.Parent.MouseButton1Click:connect(pie)
swaggin efficiency |
|
|
| Report Abuse |
|
|
|
| 16 Feb 2014 02:09 PM |
Does not work either, ilikeyou :/
Is it supposed to be ipairs or is that a typo? |
|
|
| Report Abuse |
|
|
|
| 16 Feb 2014 02:15 PM |
Disregard above reply, I tried it both ways and neither work.
Is this an impossible thing to script or what ._.? |
|
|
| Report Abuse |
|
|
|
| 16 Feb 2014 02:22 PM |
Output:
Player -1 added
15:18:21.755 - Players.Player1.PlayerGui.MainGUI.Characters.1.Open+Close.L:2: attempt to index global 'Player' (a nil value)
15:18:21.760 - Script 'Players.Player1.PlayerGui.MainGUI.Characters.1.Open+Close.L', Line 2
15:18:21.763 - stack end
And some other stuff that doesn't seem relevant to anything..
|
|
|
| Report Abuse |
|
|
iIikeyou
|
  |
| Joined: 07 Mar 2012 |
| Total Posts: 1659 |
|
|
| 16 Feb 2014 02:23 PM |
| Make sure it's a LocalScript |
|
|
| Report Abuse |
|
|
|
| 16 Feb 2014 02:34 PM |
Made it a local script, still would not work..
New output: 15:32:51.718 - Players.Player1.PlayerGui.MainGUI.Characters.1.Open+Close.L:2: attempt to index global 'Player' (a nil value)
15:32:51.727 - Script 'Players.Player1.PlayerGui.MainGUI.Characters.1.Open+Close.L', Line 2
15:32:51.729 - stack end |
|
|
| Report Abuse |
|
|
|
| 16 Feb 2014 03:00 PM |
I've been constantly trying to get this to work for three days now... If anyone can fix it that would be fantastic..
I'm almost to the point of just curling up in a ball and crying.
Seriously. |
|
|
| Report Abuse |
|
|
sebsa
|
  |
| Joined: 17 Oct 2008 |
| Total Posts: 2771 |
|
|
| 16 Feb 2014 03:09 PM |
| I tried finding out the same thing in August, till I just gave up due to the stress. |
|
|
| Report Abuse |
|
|
|
| 16 Feb 2014 03:13 PM |
| I've tried about a billion different variations of it at this point, different methods, etc. |
|
|
| Report Abuse |
|
|
|
| 16 Feb 2014 03:14 PM |
15:32:51.718 - Players.Player1.PlayerGui.MainGUI.Characters.1.Open+Close.L:2: attempt to index global 'Player' (a nil value) -- THIS IS A NIL VALUE
15:32:51.727 - Script 'Players.Player1.PlayerGui.MainGUI.Characters.1.Open+Close.L', Line 2
15:32:51.729 - stack end
Your player is not being detected that's why put rrr = player inside the actual area where player is defined |
|
|
| Report Abuse |
|
|
|
| 16 Feb 2014 03:18 PM |
| Where is Player being defined at? |
|
|
| Report Abuse |
|
|
|
| 16 Feb 2014 03:19 PM |
allowed = {"MarsPwnsAll","deathdoor95"} rrr = Player.PlayerGui.MainGUI.Characters['1'].Characters1.Lucemon -- Player is defined before the character was even added
function pie() Game:GetService("Players").PlayerAdded:connect(function(Player) for i = 1,#allowed do if Player.Name == allowed[i] then rrr.Visible = true elseif Player.Name ~= allowed then rrr.Visible = false end end end) end
script.Parent.MouseButton1Click:connect(pie)
--[["Revised"]]--
allowed = {"MarsPwnsAll","deathdoor95"}
function pie() Game:GetService("Players").PlayerAdded:connect(function(Player) rrr = Player.PlayerGui.MainGUI.Characters['1'].Characters1.Lucemon for i = 1,#allowed do if Player.Name == allowed[i] then rrr.Visible = true elseif Player.Name ~= allowed then rrr.Visible = false end end end) end
script.Parent.MouseButton1Click:connect(pie) |
|
|
| Report Abuse |
|
|
|
| 16 Feb 2014 03:20 PM |
Oh i also forgot i didn't read it correctly
Players isn't a thing you do game.Players defined at rrr |
|
|
| Report Abuse |
|
|
|
| 16 Feb 2014 03:30 PM |
Attempted to use your revised version, still does not work. :/
I have the script in the ServerScriptService, should I move it elsewhere? |
|
|
| Report Abuse |
|
|
| |
|
iIikeyou
|
  |
| Joined: 07 Mar 2012 |
| Total Posts: 1659 |
|
|
| 16 Feb 2014 03:42 PM |
allowed = {"MarsPwnsAll","deathdoor95"} for _,v in ipairs(allowed)do allowed[v]=true end function pie() game.Players.LocalPlayer.PlayerGui.MainGUI.Characters['1'].Characters1.Lucemon.Visible = allowed[game.Players.LocalPlayer.Name] end
script.Parent.MouseButton1Click:connect(pie) |
|
|
| Report Abuse |
|
|
|
| 16 Feb 2014 05:15 PM |
| Works perfectly now! Thank you all! |
|
|
| Report Abuse |
|
|