Is there any way to create a weapon which only hurts certain team? I'm just asking if it's complicated (and if it's not) how to do it. And if it's complicated, does anyone have a link to some article or tutorial on the topic?
✓ ANSWER ACCEPTED
How do you make a weapon that only hurts one team?
1 answer
✓ Accepted answer
It's a single line, you just need 2 Players, both of them have Team property which says in which team they are, you need to compare player that shot the bullet or threw the rock's team with player who got hit's team, if they are in the same team, don't dare you damage him.
local player_that_attack = [...]
local player_that_got_hit = [...]
if player_that_attack.Team == player_that_got_hit.Team then
print("u try to attack team member")
else
print("kill this pig")
end
In order to check for a different team you can use the same method:
local Teams = game:GetService("Teams")
local target_team = Teams.[...]
if some_player.Team == target_team then
print("Deal damage")
end
This discussion is preserved as it was. New answers, comments, and votes are closed.
