local Trail = game.ReplicatedStorage.RainbowTrail
local Head = character:FindFirstChild('Head') -- will wait until the head is loaded, at that time the code below will be yielded by this function, using waitforchild on something that doesnt exist will yield infinitely
local Torso = character:FindFirstChild('Torso')
local LowerTorso = character:FindFirstChild('LowerTorso') -- both has waistbackattachment
local plrTrail = Trail:Clone()
if Torso then
plrTrail.Parent = Torso
plrTrail.Attachment1 = Torso.WaistBackAttachment
elseif LowerTorso then
plrTrail.Parent = LowerTorso
plrTrail.Attachment1 = LowerTorso.WaistBackAttachment
end
plrTrail.Attachment0 = Head.FaceFrontAttachment
end
local Torso = character:FindFirstChild('Torso')
local LowerTorso = character:FindFirstChild('LowerTorso')
if Torso then
local Traill = Torso:FindFirstChild('RainbowTrail')
if Traill then Traill:Destroy() end
elseif LowerTorso then
local Traill = LowerTorso:FindFirstChild('RainbowTrail')
if Traill then Traill:Destroy() end
end
its probably because there isnt a rainbowtrail
when using a waitforchild, it will yield infinitely (yielding for the max integer limit) unless its already assigned
whats the code before trying to destroy it?
local Torso = character:FindFirstChild('Torso')
local LowerTorso = character:FindFirstChild('LowerTorso')
if Torso then
local Traill = Torso:WaitForChild('RainbowTrail')
Traill:Destroy()
elseif LowerTorso then
local Traill = LowerTorso:WaitForChild('RainbowTrail')
Traill:Destroy()
end