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

How i can remove collide from Head?

I'm trying remove collision of my head to look same this: GIF

Current script

local Players = game:GetService('Players')
local PS = game:GetService('PhysicsService')
local PlayerGroup = PS:CreateCollisionGroup('Player')
PS:CollisionGroupSetCollidable('Player','Player',false)

function NoCollide(Character)
    for i,v in next, Character:GetChildren() do
      if v:IsA("BasePart") and v.Name == 'Head' then
           PS:SetPartCollisionGroup(v,'Player')
        end
    end
end

Players.PlayerAdded:Connect(function(plr)
   plr.CharacterAdded:Connect(function(chr)
       NoCollide(chr)
    end)
end)

I got no errors

2 comments

0

Try to take away in line 8 the v:IsA("BasePart") because usually the classname of a head is a Part

0

not working yet

1 answer

Well, first, the Head is actually a Part and not a BasePart. Second, I would go for the route of printing to see where the error is, because with stuff like :IsA("???") as long as what's in the quotes exists as something ROBLOX has, it's not going to give an error; it's kind of like how :FindFirstChild("???") won't give an error. Third instead of doing the whole CollisionGroupSetCollidable, I would just set v.CanCollide to false. Fourth, next is somewhat deprecated, so just use pairs instead. Here's what I did to fix your code, tell me if it helped:)

local Players = game:GetService('Players')

function NoCollide(Character)

    for i,v in pairs(Character:GetChildren()) do
      if v:IsA("Part") and v.Name == 'Head' then
            	
		v.CanCollide = false
	else
		v.CanCollide = true
        end
    end
end

Players.PlayerAdded:Connect(function(plr)
   plr.CharacterAdded:Connect(function(chr)
       NoCollide(chr)
    end)
end)

1 comment

0

Roblox forces collide property remain in 'true' and Basepart is a primitive class of mesh, part, union .. that is, everything that is rendered and has physics is a BasePart

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