Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i make gui buttons that add and remove parts to a player's head?

Asked by 4 years ago

I'm making a testing area and i wanna make gui buttons that put a hat made out of parts on a player's head, and remove them from the player's head when the button is pressed again. I couldn't really do anything since i'm not a scripter but there's no other website i found.

1 answer

Log in to vote
0
Answered by
WoTrox 345 Moderation Voter
4 years ago

Make the hat, group it, get a character, make it like its on the character's head, delete the character, put the group inside the ReplicatedStorage, name it Hat. Then make the gui, put this script inside the button

local player = script.Parent.Parent.Parent.Parent.Parent
local hat = game.ReplicatedStore:WaitForChild("Hat"):Clone()

script.Parent.MouseButton1Click:Connect(function()

    hat.Parent = player.Character.Head

end)
0
I did this with a normal script and a local script and it didn't work. The button is there, the hat is inReplicatedStorage. DRrobloxtr 0 — 4y
0
Oh, sorry, i forgot to tell you that you need an accessory. Click at the plus next to the model's name, and search for Accessory. Press on it, then put everything that is inside the group in the accessory. Get the accessory out of the group, delete the empty group. Name the accessory Hat WoTrox 345 — 4y
0
I must be doing something wrong. I put a ScreebGui in LocalGui, put a TextButton in that gui and then put the script inside it. The accesory is in ReplicatedStorage. DRrobloxtr 0 — 4y
0
ScreenGui is in StarterGui, right? Any error codes in the output? WoTrox 345 — 4y
View all comments (4 more)
0
No errors in output. DRrobloxtr 0 — 4y
0
Hmmm... Then I don't know. Sorry :( WoTrox 345 — 4y
0
It's okay. I can try something else. (if i find it) DRrobloxtr 0 — 4y
0
If I may add, I did what you said, and it did clone the hat, but the hat maintained the coordinates of the original part and didn't actually attach to the players head, even though it was grouped to the player. American_Soldier152 0 — 4y
Ad

Answer this question