I'm trying to make a trail shop and I'm currently stuck on the phase where my Module Script returns this error:
ReplicatedStorage.ModuleScripts.Insert - attempt to index nil with 'Parent'
I've searched around both scriptinghelpers and the Roblox Devforum but I couldn't find the answer to my problem. Here's the code:
module.InsertTrail = function(plrname, trail)
local plr = game.Players:FindFirstChild(plrname)
plr.CharacterAdded:Connect(function(char)
local at0 = char.Head:WaitForChild('Attachment0')
local at1 = char.HumanoidRootPart:WaitForChild('Attachment1')
local tr = trail:Clone()
tr.Parent = char -- Error Line
tr.Attachment = at0
tr.Attachment1 = at1
end)
game.ReplicatedStorage.Trail.OnServerEvent:Connect(function()
plr.Character:FindFirstChildWhichIsA('Trail'):Destroy()
end)
end
Any help will be appreciated! :)
