I am simply wondering if this would work?
Error: Workspace.Lasers.LaserDetect:7: attempt to call a nil value
local laser = script.Parent:GetChildren()
function laserHit(Hit)
end
laser.Touched:Connect(laserHit)
I am simply wondering if this would work?
Error: Workspace.Lasers.LaserDetect:7: attempt to call a nil value
local laser = script.Parent:GetChildren()
function laserHit(Hit)
end
laser.Touched:Connect(laserHit)
I am assuming getchildren returns a table
Oh sorry, laser is a folder which contains the parts
And that is the problem – laser isn’t a mixed table. It has no Touched field therefore.
You’ll want to go through each instance individually.
local lasers = script.Parent:GetChildren() -- it's a list of items, might as well make it plural :p
local function laserHit(Hit)
end
for _, laser in ipairs(lasers) do
laser.Touched:Connect(laserHit)
end
didnt know my bad ill delete
sdfgyhuiop;
Oh thank you I didnt think of doing it like this