Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Singular trail applied onto multiple/different rigs at once?

As the title says, I have attempted to add a singular trail onto multiple rigs, but for some reason it only works for one rig and that's the first one stated in the script. It completely ignores the second stated one. The script example will be below. Thanks to anyone in advance who can help me out with this. In my example, 'check' is the character/player that touches the block.

local mainTrail = game.ServerStorage.Trail

function onTouch(Part)
local check = Part.Parent
if check.Parent ~= nil then
local Trail = mainTrail:Clone()
Trail.Parent = check.LeftUpperLeg
Trail.Attachment0 = check.LeftUpperLeg.LeftHipRigAttachment
Trail.Attachment1 = check.LeftUpperLeg.LeftKneeRigAttachment

local Trail2 = mainTrail:Clone()
Trail2.Parent = check.RightUpperLeg
Trail2.Attachment2 = check.RightUpperLeg.RightHipRigAttachment
Trail2.Attachment3 = check.RightUpperLeg.RightKneeRigAttachment
end

script.Parent.Touched:connect(onTouch)

1 comment

0

O yes I did, even with that though it still doesn't work ,so I don't think that's the problem.

1 answer

✓ Accepted answer

Hello,

You seem to be missing another end to close the function at line 3. There is a Function and an If Statement, which both need their own end. Just add another end, at line 16.

Also, Trail only have 2 Attchments. (0 and 1) you seem to have put Attachment 2 and 3 instead of 0 and 1. Try now. c:

Its supposed to look like this:

local mainTrail = game.ServerStorage.Trail

function onTouch(Part)
local check = Part.Parent
if check.Parent ~= nil then
local Trail = mainTrail:Clone()
Trail.Parent = check.LeftUpperLeg
Trail.Attachment0 = check.LeftUpperLeg.LeftHipRigAttachment
Trail.Attachment1 = check.LeftUpperLeg.LeftKneeRigAttachment

local Trail2 = mainTrail:Clone()
Trail2.Parent = check.RightUpperLeg
Trail2.Attachment0 = check.RightUpperLeg.RightHipRigAttachment
Trail2.Attachment1 = check.RightUpperLeg.RightKneeRigAttachment
end
end

script.Parent.Touched:connect(onTouch)

If any problems do occur, feel free to comment again.

Sincereley,

Arti_BLOX.

This discussion is preserved as it was. New answers, comments, and votes are closed.