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

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

Asked by
1uqt 2
1 year ago

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
0
is that an accidental parenthisis at the end of line 4 i feel like that should be behind the end at the bottom. kickoff127 103 — 1y
0
I don’t think so. If so it would give me an error 1uqt 2 — 1y
0
i dont think you need while Sphere and Sphere.Parent and Sphere.CFrame do as Sphere.Touched will always fire when it touched Puppynniko 1059 — 1y

1 answer

Log in to vote
0
Answered by
1uqt 2
1 year ago

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.

Ad

Answer this question