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

How to prevent a Ai from attacking a player on a certain team?

I understand this is not a website for asking people to write you a script from scratch but this is a question ive been wondering for a long time how can I make a Ai identify players on a team? I just cant seem to make a script that works

1 answer

if game.Players:GetPlayerFromCharacter(character).TeamColor == AI.ColorNotToAttack.Value then
--dont attack
else
--attack
end

You would need if statements and a value in the AI to know which team not to attack

1 comment

4

Put the code inside a Lua code block.

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