Hello, i have problem with this script. Enemy team player should die when he touch owner door in another team. I mean in script it says that it will kill every player, which are not in my team. Anyway it's owner door script to tycoon.

v = script.Parent.Parent.Value
click = script.Parent.ClickDetector

function wat(player)
	local character = game.Players:GetPlayerFromCharacter(player.Parent)
	if player.TeamColor == script.Parent.Parent.Parent.Parent.TeamColor.Value then
		if v.Value == true then
			v.Value = false
			script.Parent.BrickColor = BrickColor.new("Bright red")
			for i,v in pairs(script.Parent.Parent.Lasers:GetChildren()) do
				v.BrickColor = BrickColor.new("Bright green")
				v.Transparency = .8
				v.CanCollide = false
			end
				
		elseif v.Value == false then
			v.Value = true
			script.Parent.BrickColor = BrickColor.new("Bright green")
			for i,v in pairs(script.Parent.Parent.Lasers:GetChildren()) do
				v.BrickColor = BrickColor.new("Bright red")
				v.Transparency = .3
				v.CanCollide = true
				if player.Parent:FindFirstChild("Torso") then
					local exp = Instance.new("Explosion")
					exp.BlastRadius = 3
					exp.Position = player.Position
					exp.Parent = workspace
					print("added explosion")
					if player.Parent:FindFirstChild("Humanoid") then
						player.Parent.Humanoid.Health = 0
						print("killed")
					end
				end
			end
			
		end
	end
end

click.MouseClick:connect(wat)

1 comment

1

Erm, you say when they touch, but its bound by a click detector. Please make sure you know what you're doing when posting a script. Simpfully asking things about free models / asking to fix free models isn't what this site is for.