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: Why won't this work?!?!

Previous Thread :: Next Thread 
MarsPwnsAll is not online. MarsPwnsAll
Joined: 10 Jul 2011
Total Posts: 314
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 is not online. 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
MarsPwnsAll is not online. MarsPwnsAll
Joined: 10 Jul 2011
Total Posts: 314
16 Feb 2014 02:09 PM
Does not work either, ilikeyou :/

Is it supposed to be ipairs or is that a typo?
Report Abuse
MarsPwnsAll is not online. MarsPwnsAll
Joined: 10 Jul 2011
Total Posts: 314
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
MarsPwnsAll is not online. MarsPwnsAll
Joined: 10 Jul 2011
Total Posts: 314
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 is not online. iIikeyou
Joined: 07 Mar 2012
Total Posts: 1659
16 Feb 2014 02:23 PM
Make sure it's a LocalScript
Report Abuse
MarsPwnsAll is not online. MarsPwnsAll
Joined: 10 Jul 2011
Total Posts: 314
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
MarsPwnsAll is not online. MarsPwnsAll
Joined: 10 Jul 2011
Total Posts: 314
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 is not online. 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
MarsPwnsAll is not online. MarsPwnsAll
Joined: 10 Jul 2011
Total Posts: 314
16 Feb 2014 03:13 PM
I've tried about a billion different variations of it at this point, different methods, etc.
Report Abuse
Andrew1234567mmm is not online. Andrew1234567mmm
Joined: 14 Oct 2009
Total Posts: 691
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
MarsPwnsAll is not online. MarsPwnsAll
Joined: 10 Jul 2011
Total Posts: 314
16 Feb 2014 03:18 PM
Where is Player being defined at?
Report Abuse
Andrew1234567mmm is not online. Andrew1234567mmm
Joined: 14 Oct 2009
Total Posts: 691
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
Andrew1234567mmm is not online. Andrew1234567mmm
Joined: 14 Oct 2009
Total Posts: 691
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
MarsPwnsAll is not online. MarsPwnsAll
Joined: 10 Jul 2011
Total Posts: 314
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
Andrew1234567mmm is not online. Andrew1234567mmm
Joined: 14 Oct 2009
Total Posts: 691
16 Feb 2014 03:39 PM
Output?
Report Abuse
iIikeyou is not online. 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
MarsPwnsAll is not online. MarsPwnsAll
Joined: 10 Jul 2011
Total Posts: 314
16 Feb 2014 05:15 PM
Works perfectly now! Thank you all!
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