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

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

Asked by 7 years ago
Edited 7 years ago

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)
0
Don't use :Remove its deprecated. Use :Destroy instead. User#15461 0 — 7y
0
Oh wow I never knew :Remove() got deprecated ._. GimmeWaffleBruh 18 — 7y
0
I tried the same with :Destroy but no difference. KemiCAL02 8 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

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

0
What do you mean? KemiCAL02 8 — 7y
Ad

Answer this question