I'm trying to make a team nocollide with every other team, but something keeps breaking the physics.
[code]hook.Add("ShouldCollide","NCPlayers",function(a,b)
if a:Team() == TEAM_PRISONER_GHOST and b:IsPlayer() then
return false else return true
end
end)
[/code]
Whenever a player from TEAM_PRISONER_GHOST touches another player, props start falling through the floor and weapons just bounce around. It's weird because this seems to not cause any issues, but it makes all players nocollide with each other and not just one team.
[code]hook.Add("ShouldCollide","NCPlayers",function(a,b)
if a:IsPlayer() and b:IsPlayer() then
return false else return true
end
end)[/code]
Don't return true otherwise - just return false and nothing else if the if-statement doesn't pass. Also, you should check it "a" is a player before running the Team function.
I changed it to this and it's still doing the same thing
You need to check if a or b are players and match the team; the order of the arguments shouldn't matter in your hook logic in this case.
I changed it to this and it worked thanks!
hook.Add("ShouldCollide","NCPlayers",function(a,b)
if a:IsPlayer() and b:IsPlayer() then
if a:Team() == TEAM_PRISONER_GHOST or b:Team() == TEAM_PRISONER_GHOST then
return false
end
end
end)
Sorry, you need to Log In to post a reply to this thread.