Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

My hair GUI that makes hair appear on character when clicked doesn't work, but no errors in script?

Basically, it's a script where when you click a hair on a GUI, the hair appears on your character, but if you click on a different hair the hair appearing on character disappears and the other appears, if that makes any sense. It all works up to the point that the first hair doesn't disappear when the other is clicked. See my script here:

function onButtonClicked()
game.Players.LocalPlayer.leaderstat.Hat.Value = 10
if game.Players.LocalPlayer.leaderstat.Hat.Value == 10 then
hair = game.ReplicatedStorage.CBeauty:Clone()
hair.Name = "Hair"
hair.Parent = game.Players.LocalPlayer.Character
local w = Instance.new("Weld")
w.Part0 = game.Players.LocalPlayer.Character.Head
w.Part1 = hair
w.Parent = game.Players.LocalPlayer.Character.Head
w.C0 = w.C0 * CFrame.new(-0,-0.5,0.2)*CFrame.fromEulerAnglesXYZ(0, math.pi, 0)
wait(0.3)
elseif game.Players.LocalPlayer.leaderstat.Hat.Value ~= 10 then
hair:Remove()
end
end




script.Parent.MouseButton1Click:connect(onButtonClicked)

3 comments

0

Don't use :Remove its deprecated. Use :Destroy instead.

0

Oh wow I never knew :Remove() got deprecated ._.

0

I tried the same with :Destroy but no difference.

1 answer

You need to specify certain numbers for it to remove the other when its clicked

1 comment

0

What do you mean?

This discussion is preserved as it was. New answers, comments, and votes are closed.