If your character is r15, this will not work
this is the universal way to do it (works with r15 and r6)
if its mainly r6 then change the rootpart below to torso if you want
local Trail = game.ServerStorage["RainbowTrail"]
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
local RootPart = char:WaitForChild('HumanoidRootPart')
local Head = char:WaitForChild('Head')
local plrTrail = Trail:Clone()
plrTrail.Parent = RootPart
plrTrail.Attachment0 = Head.FaceFrontAttachment
plrTrail.Attachment1 = RootPart.WaistBackAttachment
end)
end)
okay thankyou! I put this script in and it comes up with this 11:57:38.050 WaistBackAttachment is not a valid member of Part “t3h1dy.HumanoidRootPart” - Server - RainbowTrail:10
alright i have been thinking for quite a while now but here u go
local Trail = game.ServerStorage["RainbowTrail"]
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
local Head = char:WaitForChild('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 = char:FindFirstChild('Torso')
local LowerTorso = char:FindFirstChild('LowerTorso') -- both has waistbackattachment
local plrTrail = Trail:Clone()
if Torso then
plrTrail.Parent = Torso
plrTrail.Attachment1 = Torso.WaistBackAttachment
else if LowerTorso then
plrTrail.Parent = LowerTorso
plrTrail.Attachment1 = LowerTorso.WaistBackAttachment
end
end
plrTrail.Attachment0 = Head.FaceFrontAttachment
end)
end)
The problem was the character wasn’t fully loaded yet
Adding a wait at the start fixed it…
local Trail = game.ServerStorage["RainbowTrail"]
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
task.wait()
local Head = char: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 = char:FindFirstChild('Torso')
local LowerTorso = char: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)
end)
if not Player:HasAppearanceLoaded() then Player.CharacterAppearanceLoaded:Wait() end
To yield the script until the player’s character’s appearance has loaded.