Basically I'm making a forcefield type of thing for a weapon I'm making. This forcefield is supposed to delete any projectiles that touch it. The problem is if the forcefield is moved, the .Touched event would fire, but only as some weird invisible field at the location it first spawned in.
function AddFeatures(Sphere, Range)
while Sphere and Sphere.Parent and Sphere.CFrame do
Sphere.Touched:connect(function()
for i, v in pairs(Sphere:GetTouchingParts()) do
if v and v.Parent then
HandleDeflect(Sphere, v)
end
end
end)
wait()
end
end

3 comments
is that an accidental parenthisis at the end of line 4 i feel like that should be behind the end at the bottom.
I don’t think so. If so it would give me an error
i dont think you need while Sphere and Sphere.Parent and Sphere.CFrame do as Sphere.Touched will always fire when it touched