Robotz04
|
  |
| Joined: 25 Feb 2011 |
| Total Posts: 6369 |
|
|
| 14 Jul 2017 03:11 PM |
I want a script that when we equip a tool, the GUI appears and when we unequip, it disappears.
Let's suppose that the gui is named "GUI"
|
|
|
| Report Abuse |
|
|
EataPig98
|
  |
| Joined: 01 Mar 2014 |
| Total Posts: 173 |
|
|
| 14 Jul 2017 03:17 PM |
--localscript inside tool with the gui inside the script local player = nil script.Parent.Equipped:connect(function() player = game.Players:GetPlayerFromCharacter(script.Parent) script.GUI.Parent = player.PlayerGUI end) script.Parent.Unequipped:connect(function() player = game.Players:GetPlayerFromCharacter(script.Parent) script.GUI.Parent = script end)
should work |
|
|
| Report Abuse |
|
|
Robotz04
|
  |
| Joined: 25 Feb 2011 |
| Total Posts: 6369 |
|
| |
|
EataPig98
|
  |
| Joined: 01 Mar 2014 |
| Total Posts: 173 |
|
| |
|
EataPig98
|
  |
| Joined: 01 Mar 2014 |
| Total Posts: 173 |
|
|
| 14 Jul 2017 03:29 PM |
| whoops, i made a mistake, it should be GetPlayerFromCharacter(script.Parent.Parent) |
|
|
| Report Abuse |
|
|
EataPig98
|
  |
| Joined: 01 Mar 2014 |
| Total Posts: 173 |
|
|
| 14 Jul 2017 03:30 PM |
| and PlayerGUI should be PlayerGui |
|
|
| Report Abuse |
|
|
Robotz04
|
  |
| Joined: 25 Feb 2011 |
| Total Posts: 6369 |
|
|
| 14 Jul 2017 03:33 PM |
I noticed & fixed it already lol
|
|
|
| Report Abuse |
|
|
Robotz04
|
  |
| Joined: 25 Feb 2011 |
| Total Posts: 6369 |
|
|
| 14 Jul 2017 03:36 PM |
Also, you should of made a variable GUI instead of doing script.GUI because once you want to unequip, the gui is in playergui and not in the script.
So i created a clone and i fixed all this stuff :P
|
|
|
| Report Abuse |
|
|
EataPig98
|
  |
| Joined: 01 Mar 2014 |
| Total Posts: 173 |
|
|
| 14 Jul 2017 03:36 PM |
just incase there are any other errors, just try:
wait() local player = nil script.Parent.Equipped:connect(function() player = game.Players:GetPlayerFromCharacter(script.Parent.Parent) script.GUI:Clone().Parent = player.PlayerGui end) script.Parent.Unequipped:connect(function() player.PlayerGui.GUI:Destroy() player = nil end)
i tested it and it works perfectly. |
|
|
| Report Abuse |
|
|
Robotz04
|
  |
| Joined: 25 Feb 2011 |
| Total Posts: 6369 |
|
|
| 14 Jul 2017 03:51 PM |
no its ok, i already fixed it
|
|
|
| Report Abuse |
|
|
|
| 14 Jul 2017 03:53 PM |
you really shouldn't of just gave him the script
he wont learn ;-; |
|
|
| Report Abuse |
|
|
Robotz04
|
  |
| Joined: 25 Feb 2011 |
| Total Posts: 6369 |
|
|
| 14 Jul 2017 03:53 PM |
Expensive, are you kidding me i literally fixed the whole script i know all what he did in the code. I'm not the one who asks for a script and put it in my game like that.
|
|
|
| Report Abuse |
|
|
|
| 14 Jul 2017 04:12 PM |
he still gave you the script.
you fixed a line or two |
|
|
| Report Abuse |
|
|
Robotz04
|
  |
| Joined: 25 Feb 2011 |
| Total Posts: 6369 |
|
| |
|
Mine_rr
|
  |
| Joined: 09 Aug 2015 |
| Total Posts: 35 |
|
|
| 17 Nov 2017 07:10 PM |
| Where should the tool be? I put it in Starter Pack and it wont work. |
|
|
| Report Abuse |
|
|