Oskee
|
  |
| Joined: 24 Jul 2014 |
| Total Posts: 297 |
|
|
| 10 Nov 2014 01:27 PM |
I see no nil values here. I checked and made sure everything was in it's place.
game.Players.PlayerAdded:connect(function(plr) function quest() local chatgui = script.Parent.Chat chatgui:Clone().Parent = plr.PlayerGui end end)
script.Parent.MouseButton1Down:connect(quest) |
|
|
| Report Abuse |
|
|
|
| 10 Nov 2014 01:28 PM |
Wow. You did this completely wrong.
You can't call a function from a function. And plr is a nil value. |
|
|
| Report Abuse |
|
|
|
| 10 Nov 2014 01:28 PM |
local chatgui = script.Parent.Chat chatgui:Clone().Parent = plr.PlayerGui
that means one of these dont exist as written
im guessing its chatgui |
|
|
| Report Abuse |
|
|
Oskee
|
  |
| Joined: 24 Jul 2014 |
| Total Posts: 297 |
|
|
| 10 Nov 2014 01:29 PM |
@Hyroad
then show me senpai |
|
|
| Report Abuse |
|
|
| |
|
powertool
|
  |
| Joined: 01 Feb 2008 |
| Total Posts: 3771 |
|
|
| 10 Nov 2014 01:32 PM |
Hyroad gtfo
You can create functions within functions. I do so fairly often. Furthermore, it is incredibly possible to call a function from within a function. I do so more often.
OP, I see nothing implicitly wrong with this, besides some strange cloning things. I've tried to make it more reliable, but no guarantees. I also noticed that plr isn't carried on down into quest(), so for the sake of fixing this, I've just trashed that inner function and made it part of the anon function.
game.Players.PlayerAdded:connect(function(plr) local chatgui = script.Parent.Chat local cgc = chatgui:Clone() cgc.Parent = plr.PlayerGui end)
|
|
|
| Report Abuse |
|
|
robocu3
|
  |
| Joined: 13 Mar 2009 |
| Total Posts: 6485 |
|
|
| 10 Nov 2014 01:34 PM |
Though that is somewhat inefficient. :/ lol ^^ -=Robo=- |
|
|
| Report Abuse |
|
|
| |
|
powertool
|
  |
| Joined: 01 Feb 2008 |
| Total Posts: 3771 |
|
|
| 10 Nov 2014 01:36 PM |
| It's clear, concise, and works. There isn't a lot of optimizing that can be done on it. I personally prefer clear, concise, and working over convoluted, optimized, hard to edit, and working. |
|
|
| Report Abuse |
|
|
Oskee
|
  |
| Joined: 24 Jul 2014 |
| Total Posts: 297 |
|
|
| 10 Nov 2014 01:36 PM |
@Power
Thanks for helping but your script destroys the meaning of the player clicking the block(or specifically, the image button in a surface gui) to activate the gui. |
|
|
| Report Abuse |
|
|
|
| 10 Nov 2014 01:36 PM |
| And I'd prefer you to stop talking. |
|
|
| Report Abuse |
|
|
robocu3
|
  |
| Joined: 13 Mar 2009 |
| Total Posts: 6485 |
|
|
| 10 Nov 2014 01:38 PM |
There is quite a bit he can do. He can localize that function in the global scope and put it in the connection lines parameter rather than committing to a pseudo function and then creating a new function every time the event is called, that's ridiculous. lol -=Robo=- |
|
|
| Report Abuse |
|
|
Oskee
|
  |
| Joined: 24 Jul 2014 |
| Total Posts: 297 |
|
|
| 10 Nov 2014 01:40 PM |
so trying this would not work?
game.Players.PlayerAdded:connect(function(player) function quest(player) cgui = script.Parent.Chat local cgc =cgui:Clone() cgc.Parent = player.PlayerGui end end)
script.Parent.MouseButton1Down:connect(quest) |
|
|
| Report Abuse |
|
|
|
| 10 Nov 2014 01:40 PM |
Lol. Powertool sent me a message:
No need to act like a stuck-up self-important prick.
He knows I'm right, doe. |
|
|
| Report Abuse |
|
|
powertool
|
  |
| Joined: 01 Feb 2008 |
| Total Posts: 3771 |
|
|
| 10 Nov 2014 01:42 PM |
| Hyroad, you know damn well what I mean. If you're so convinced you can do it better, then do so. Stop acting like you're superior unless you can prove it. |
|
|
| Report Abuse |
|
|
| |
|
|
| 10 Nov 2014 01:45 PM |
I'm a little rusty with billboards. uhh let's see..
|
|
|
| Report Abuse |
|
|
|
| 10 Nov 2014 01:47 PM |
I guess when you click the buttons it doesn't return the player who clicked. So yuh, this is tricky.
|
|
|
| Report Abuse |
|
|
Oskee
|
  |
| Joined: 24 Jul 2014 |
| Total Posts: 297 |
|
|
| 10 Nov 2014 01:48 PM |
It isn't a billboard, it is a surfacegui with a image button in it. The purpose is that if you click that image button, a gui would be placed in your player's playergui and that gui would have info about the quest.
All I wanted to do was make a simple quest script ;-; |
|
|
| Report Abuse |
|
|
Looah
|
  |
| Joined: 22 Feb 2013 |
| Total Posts: 922 |
|
|
| 10 Nov 2014 01:50 PM |
everybody shut up and realize that quest is in the scope of the anonymous function linked to the event of PlayerAdded
correct code;
script.Parent.MouseButton1Down:connect(function() script.Parent.Chat:clone().Parent=game.Players.LocalPlayer.PlayerGui end)
shove it in a local script and you're good |
|
|
| Report Abuse |
|
|
padam11
|
  |
| Joined: 11 Feb 2013 |
| Total Posts: 15774 |
|
|
| 10 Nov 2014 01:51 PM |
(tool)lol noob whenplayer("do it urself noob")
"Counting is paramount." |
|
|
| Report Abuse |
|
|
Looah
|
  |
| Joined: 22 Feb 2013 |
| Total Posts: 922 |
|
|
| 10 Nov 2014 01:52 PM |
@OP well, actually, if it's a surfacegui, make it a local part and then do the stuff to it wiki says so. |
|
|
| Report Abuse |
|
|
Oskee
|
  |
| Joined: 24 Jul 2014 |
| Total Posts: 297 |
|
|
| 10 Nov 2014 01:54 PM |
But the.. ugh more explaining. So there is BRICK, that has a SURFACEGUI on it. In that surfacegui is a IMAGEBUTTON. The script is meant so that when the player CLICKS the button, it would clone it into their PLAYERGUI. So putting it in a localscript will NOT work. |
|
|
| Report Abuse |
|
|
Looah
|
  |
| Joined: 22 Feb 2013 |
| Total Posts: 922 |
|
| |
|
Oskee
|
  |
| Joined: 24 Jul 2014 |
| Total Posts: 297 |
|
|
| 10 Nov 2014 01:55 PM |
| I've never heard of this 'Local Part'. |
|
|
| Report Abuse |
|
|