How to make If player is not in team kill

  1. What do you want to achieve? Keep it simple and clear!

If player touches part and player is not in team then kill player

  1. What is the issue? Include screenshots / videos if possible!

My script isn’t working. It just doesn’t kill that player

Here is my script:

script.Parent.Touched:Connect(function(hit)
	local player = game.Players:GetPlayerFromCharacter(hit.Parent)
	if player then
		if player.Team.Name == game:GetService("Teams").General then
			
		elseif player.Team.Name == game:GetService("Teams").Soldier then
			hit.Parent:WaitForChild("Humanoid").Health = 0
		end
	end
end)
  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I tried to look on forum but I didn’t solution for it.

script.Parent.Touched:Connect(function(hit)
	local player = game.Players:GetPlayerFromCharacter(hit.Parent)
	if player then
		if player.Team == game:GetService("Teams").General then
			
		elseif player.Team == game:GetService("Teams").Soldier then
			hit.Parent:WaitForChild("Humanoid").Health = 0
		end
	end
end)

try doing this

Omg I feel so stupid xD. I didn’t even notice that i put .Name after player.Team xD Thx anyways

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.