0

# How i can remove collide from Head?

sO_Ov 275
5 months ago

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

NoCollide(chr)
end)
end)



I got no errors

0
Try to take away in line 8 the v:IsA("BasePart") because usually the classname of a head is a Part CoolMcroy 35 — 5mo
0
not working yet sO_Ov 275 — 5mo

0

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