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

.Touched doesn't fire when an anchored part is moved?

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

0

is that an accidental parenthisis at the end of line 4 i feel like that should be behind the end at the bottom.

0

I don’t think so. If so it would give me an error

0

i dont think you need while Sphere and Sphere.Parent and Sphere.CFrame do as Sphere.Touched will always fire when it touched

1 answer

Nothing with my code was wrong. I just realized that Roblox's move tool in testing mode is client-sided and moving it with F3X works.

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