Enemies and Allies can kill Its door

Hi Developers
when i was doing the door that kills the enemies
for some reason the door can kill not only enemies but also allies
the door works with the help of humanoid i was looking for a lot of info

  1. I just made an invisible wall. It helped, it’s not convenient.
  2. I wanted only Npc weapons to be killed, but I had to replace which, in players, is it difficult to have them 16? (this is about their weapons 16)
2 Likes

Considering there’s nothing to work off of other than a scenario, it’s hard to help you resolve the issue you’re experiencing. Are you not filtering the users that enter through your doors and checking if they’re permitted to enter?

Teams?

Could you provide us the code so we could fix it? It is hard to find a solution without code to go with it.

Stop npc can refer to the teams?

I could provide but I have a problem with the scripts

data%200123
I can only provide this snapshot.

Can you provide us the script in the Door part?

1 Like

this just Empty script u dont know

Use the script to detect whenever a player touches the kill box with the Touched event.
Door.KillBox.Touched:Connect(function()
INSERT PLAYER CHECKING AND KILL CODE
end)
After that, check if they’re on say red or blue team. If they’re not on the team that the door is supposed to not kill, the player that passed through will die. You can kill them by using
Humanoid.Health = 0

1 Like

You know, I understood your idea, but as I said, I am not friends with scripts, but thanks

First, can you tell me how the player joins a team?

i have in toolbox model

Put this into script and put script inside door that does not kill red and test

script.Parent.Touched:Connect(function(h)
      if not h.Parent:IsA("Accessory") then
   	 	local target = h.Parent:GetPlayerFromCharacter() 
  		if target.TeamColor ~= "Really red" then
   			h.Parent.Humanoid.Health = 0
	 	end
	 end
end)

If this does not work, can I see error message?

The script does not work but I did not see Error
this error GetPlayerFromCharacter is not a valid member of Accessory

I made an edit and if this doesn’t work again I’ll need the error message.

Also that error means the door touched an Accessory from a player. I forgot to script what happens when it touches Accessory.

I think that there is a different but non-opinion simple way to do it.

There’s another way where you can insert a Number Value into a player. For example, red = 1 and blue = 2. And the door will check what the value is inside player.

But I am going to sleep now. Hopefully, others will add to my solution and find a way. Good luck!