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

How do i make it so, if the script doesn't find the Hair1, another Hair Appears?

I have a ssj2 script, and in the script i wrote a line where it tells the script if it finds a Hair1 inside the player, it will remove/destroy it and make another hair appear. When i test it, the Hair1 removes but the Hair2 doesn't appear.

if player.Character:FindFirstChild("Hair1") then
	player.Character:FindFirstChild("Hair1"):Remove()
	else 
local Hair1 = rs.Hairs.SSJ2:Clone()
Hair1.Parent = player.Character
Hair1.Name = "Hair2"
Hair1.Anchored = false
Hair1.CFrame = CFrame.new(0, 4.5, 1)
Hair1.Size = Vector3.new(2.5, 2.5, 2.7)

local Weld = Instance.new("Weld", player.Character.Head)
Weld.Part0 = player.Character.Head
Weld.Part1 = Hair1
Weld.C0 = CFrame.new(-.1, 1, .5)

1 answer

Remove line 8 and replace line 14 with

Weld.C1 = CFrame.new(0,0,0)

So,

if player.Character:FindFirstChild("Hair1") then
    player.Character:FindFirstChild("Hair1"):Remove()
    else
local Hair1 = rs.Hairs.SSJ2:Clone()
Hair1.Parent = player.Character
Hair1.Name = "Hair2"
Hair1.Anchored = false

Hair1.Size = Vector3.new(2.5, 2.5, 2.7)

local Weld = Instance.new("Weld", player.Character.Head)
Weld.Part0 = player.Character.Head
Weld.Part1 = Hair1
Weld.C1 = CFrame.new(0,0,0) --Make Adjustments here

4 comments

0

Accept my friend request I sent on my other account.

0

It still doesn't make the Hair2 appear if Hair1 is removed if found in the player

0

You forgot to put "end" for the if statement.

0

I didn't. I didn't paste the full script, and the end of the script i wrote an "end" for the if statement

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