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

Detected part sets itself to cancollide true? [region3]

Asked by
npott13 23
7 years ago
Edited 7 years ago

With region3 detector, whenever "Detect" is found and changed to name "Torso" it sets itself to cancollide = true even tho i already made it cancollide = false .. Even before i play test the part is already cancollide false it just changed when it's detected.

while wait() do

    local d = script.Parent
    local pos = d.Position
    local size = d.Size/2
    local reg = Region3.new(pos - size, pos + size)
    local ignore = {workspace.Baseplate,d}
    local n = workspace:FindPartsInRegion3WithIgnoreList(reg,ignore,100)
    if #n <= 0 then
        print("None")

    else
        for i,v in pairs(n) do
if v.Name == "Detect" then
v.CanCollide = false
v.Name = "Torso" 
end
end

        end
end

1 answer

Log in to vote
0
Answered by 7 years ago

If the part you are detecting is a sibling to a Humanoid (that is, you could do v.Parent.Humanoid and it wouldn't error), then this explains the behaviour you're seeing. I tested it, and any part named "Torso" will have its CanCollide set to true, and there's nothing you can do about it (except naming it something else or removing the Humanoid).

Ad

Answer this question