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

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

Asked by
oSyM8V3N 429 Moderation Voter
6 years ago
Edited 6 years ago

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

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

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
0
Accept my friend request I sent on my other account. DeathGunner132 120 — 6y
0
It still doesn't make the Hair2 appear if Hair1 is removed if found in the player oSyM8V3N 429 — 6y
0
You forgot to put "end" for the if statement. DeathGunner132 120 — 6y
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 oSyM8V3N 429 — 6y
Ad

Answer this question