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

Why won't the CharacterAdded code work?

local function onCharacterAdded(character)
	for i, v in pairs(character:GetChildren())
	do v.CollisionGroupId = 3
	end
end

4 comments

0

Do you connect that function to the actual event?

0

you have to do it in a local script

0

why

0

and where

1 answer

You need to make sure that it checks if its a part or not. Also make sure that the character isnt nil.

local function onCharacterAdded(character)
	if character then
	    for i, v in pairs(character:GetChildren()) do
			if v:IsA('BasePart') then
				v.CollisionGroupId = 3 
			end
	    end
	end
end

2 comments

1

it's a character added event though...It fires after the character exists

0

I like to double check.. and what about it huh. Ye i snapped :P

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