of     1   

George_Becker
#141232751Wednesday, July 23, 2014 2:58 AM GMT

How could I script it so when you press a GUI Button, it clones a hat to the player?
Origin_Sea
#141236028Wednesday, July 23, 2014 3:31 AM GMT

--script is a local script, placed in the textbutton. wait(2) script.Parent.MouseButton1Click:connect(function() plr = game.Players.LocalPlayer h = hat:Clone() --lets say you defined hat as the hat you wanted to clone. h.Parent = plr.Character end
128GB
#141236229Wednesday, July 23, 2014 3:33 AM GMT

@Silver I think that would work but its kinda messy code. I think you should learn about local variables Also if you only use something once you shouldn't set a variable to it
Funse
#141236274Wednesday, July 23, 2014 3:33 AM GMT

Best you weld it, because noobs can press =.
128GB
#141236477Wednesday, July 23, 2014 3:35 AM GMT

@Roblox How is it being new to remove a hat?
Origin_Sea
#141236854Wednesday, July 23, 2014 3:38 AM GMT

@128GB for hat, I meant that he would save hats under it. Like, say the hat is in the lighting, I meant change "hat" to game.Lighting.HatNameHere Also, I haven't really used local varuables that often, I suppose I should start :/
128GB
#141236974Wednesday, July 23, 2014 3:40 AM GMT

I was talking about this plr = game.Players.LocalPlayer You should use local variables anytime you can
Origin_Sea
#141238398Wednesday, July 23, 2014 3:54 AM GMT

k den and I usually use game.Player.LocalPlayer very often in every script, so I save a bit of typing. Though you are right, I didn't need that. Just old habits (when I was a beginner, I used to think you needed to save game.Players.LocalPlayer in a variable. Of course, I know better now, but they're habits)
128GB
#141238608Wednesday, July 23, 2014 3:56 AM GMT

I still suggest using local variables whenever possible (Its really always possible) Do you know how to use them?
George_Becker
#141239464Wednesday, July 23, 2014 4:04 AM GMT

My hat isn't actually a "hat", it's a part.
Origin_Sea
#141240594Wednesday, July 23, 2014 4:16 AM GMT

Oh...then you would need to weld it... w = Instance.new("Weld") w.Part0 = hat w.Part1 = game.Players.LocalPlayer.Character.Head w.C0 = game.Players.LocalPlayer.Character.Head.Position pehh...thats all I got... I'm no good with welding. I'll learn though.

    of     1