|
| 15 Aug 2013 04:36 AM |
victim = script.Parent.Parent.Parent.Parent.Character
function kill() p = script:GetChildren() for i = 1,#p do if p[i].className == "Hat" then p[i]:clone().Parent = victim end end end wait(0.1) script.Parent.Parent:remove()
script.Parent.MouseButton1Down:connect(kill)
Desired Effect; I want it to give you the hats, but not remove the previous ones. Instead, it removes the GUI. (GUI being Parent.Parent)
|
|
|
| Report Abuse |
|
|
noah
|
  |
| Joined: 11 Sep 2006 |
| Total Posts: 18977 |
|
|
| 15 Aug 2013 04:44 AM |
Put this in a localscript.
player = game.Players.LocalPlayer
script.Parent.MouseButton1Down:connect(function(a) for i,v in pairs (script:GetChildren()) do if v:IsA("Hat") then v.Parent = player.Character end end end)
|
|
|
| Report Abuse |
|
|
noah
|
  |
| Joined: 11 Sep 2006 |
| Total Posts: 18977 |
|
|
| 15 Aug 2013 04:45 AM |
Forgot some things.
player = game.Players.LocalPlayer
script.Parent.MouseButton1Down:connect(function(a) for i,v in pairs (script:GetChildren()) do if v:IsA("Hat") then clone = v:Clone() clone.Parent = player.Character end end script.Parent:Destroy() -- want the gui to be one use only? end) |
|
|
| Report Abuse |
|
|
|
| 15 Aug 2013 04:46 AM |
| Shouldn't it be Parent.Parent, or should I just leave it as the one Parent? |
|
|
| Report Abuse |
|
|
noah
|
  |
| Joined: 11 Sep 2006 |
| Total Posts: 18977 |
|
|
| 15 Aug 2013 04:50 AM |
| If you wanted to remove the button gui then it would be one parent. |
|
|
| Report Abuse |
|
|
|
| 15 Aug 2013 04:51 AM |
So far it's removing the GUI perfectly, but the hat isn't attaching. Testing to see if it's something I've done, or if it's the script. Most likely something I've done. |
|
|
| Report Abuse |
|
|
|
| 15 Aug 2013 04:54 AM |
| Testing it in a server, can't trust test mode. |
|
|
| Report Abuse |
|
|
|
| 15 Aug 2013 04:56 AM |
Nope, it's not working. It removes the GUI, but it doesn't give the hat. |
|
|
| Report Abuse |
|
|
|
| 15 Aug 2013 06:35 AM |
Fixed. Didn't realize that the hat had to be inserted into the script. Before, it took it out of the GUI.
Thanks, Noah. |
|
|
| Report Abuse |
|
|