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
 

Need help fixing hat GUI

Previous Thread :: Next Thread 
geckohero17 is not online. geckohero17
Joined: 27 Dec 2009
Total Posts: 1342
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 is not online. 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 is not online. 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
geckohero17 is not online. geckohero17
Joined: 27 Dec 2009
Total Posts: 1342
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 is not online. 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
geckohero17 is not online. geckohero17
Joined: 27 Dec 2009
Total Posts: 1342
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
geckohero17 is not online. geckohero17
Joined: 27 Dec 2009
Total Posts: 1342
15 Aug 2013 04:54 AM
Testing it in a server, can't trust test mode.
Report Abuse
geckohero17 is not online. geckohero17
Joined: 27 Dec 2009
Total Posts: 1342
15 Aug 2013 04:56 AM
Nope, it's not working.
It removes the GUI, but it doesn't give the hat.
Report Abuse
geckohero17 is not online. geckohero17
Joined: 27 Dec 2009
Total Posts: 1342
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
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