Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Singular trail applied onto multiple/different rigs at once?

Asked by 6 years ago
Edited 6 years ago

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)
0
O yes I did, even with that though it still doesn't work ,so I don't think that's the problem. Plutoeros 2 — 6y

1 answer

Log in to vote
2
Answered by 6 years ago
Edited 6 years ago

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.

Ad

Answer this question