Hi, I have recently been trying to create a script where fires cannot be cloned in a part or object non stop, and this script does that. However, I only want one fire object to be present in the part, not hundreds of them which I use another cloning script for.
This is my code:
while wait() do
for i, v in pairs (script.Parent:GetChildren()) do
if v then
if v.Name == "Fire" then
for i = 1, (#v -1) do --Error line
v:Destroy()
wait()
end
end
else return
end
end
end
Line 5 seems to be the error in the output. This is what is printed in the output: Workspace.DanielRocky.HumanoidRootPart.OneFireOnly:5: attempt to get length of local 'v' (a userdata value)>
Help please?

1 comment
You attempted to get the length of a userdata (Instance). Instances have no length.