I am simply trying to recreate the disappearing orb from Sword Fight on The Height IV for practice and fun. If you have a recommendation for simplifying this please tell me because it is kind of repetitive.
script:
tool = script.Parent
handle = tool.Handle
LARM = nil
RARM = nil
LLEG = nil
RLEG = nil
THEAD = nil
CTORSO = nil
function GetCharParts()
if tool.Parent.ClassName == "Model" then
LARM = tool.Parent:FindFirstChild('Left Arm')
RARM = tool.Parent:FindFirstChild('Right Arm')
LLEG = tool.Parent:FindFirstChild('Left Leg')
RLEG = tool.Parent:FindFirstChild('Right Leg')
THEAD = tool.Parent:FindFirstChild('Head')
CTORSO = tool.Parent.Torso
for i,v in pairs(tool.Parent:GetChildren()) do
if v.ClassName == "Hat" then
THATS = v
end
end
for i,v in pairs(THEAD:GetChildren()) do
if v.ClassName == "Decal" then
HDECAL = v
end
end
end
end
function ChangeCharParts()
GetCharParts()
for i=1, 1 do
wait(1)
THATS.Parent = game.Lighting
HDECAL.Parent = game.Lighting
end
for i=1, 10 do
wait(.1)
LARM.Transparency = LARM.Transparency+.1
RARM.Transparency = RARM.Transparency+.1
LLEG.Transparency = LLEG.Transparency+.1
RLEG.Transparency = RLEG.Transparency+.1
THEAD.Transparency = THEAD.Transparency+.1
CTORSO.Transparency = CTORSO.Transparency+.1
end
end
function ChangeCharParts2()
GetCharParts()
for i,v in pairs(game.Lighting:GetChildren()) do
if v.ClassName == "Hat" then
v.Parent = tool.Parent
end
if v.ClassName == "Decal" then
v.Parent = THEAD
end
end
for i=1, 10 do
wait(.1)
LARM.Transparency = LARM.Transparency-.1
RARM.Transparency = RARM.Transparency-.1
LLEG.Transparency = LLEG.Transparency-.1
RLEG.Transparency = RLEG.Transparency-.1
THEAD.Transparency = THEAD.Transparency-.1
CTORSO.Transparency = CTORSO.Transparency-.1
end
end
tool.Activated:connect(function()
GetCharParts()
if LARM.Transparency >= 0 then
ChangeCharParts()
end
wait(10)
if LARM.Transparency == 0 then
ChangeCharParts2()
end
end)
