I want the door to be able to kill a person who is not on the team for ex: Blue and if a person tries to enter whenever it's closed they die..
What am I doing wrong?...
val = script.Parent.Parent.Parent.Value -- Open / Closed Value
function touc(part)
local plr = script.Parent.Parent.Parent.Parent.Parent.TeamColor.Value
--local plr = game.Players:FindFirstChild(part.Parent.Name)
if plr then
local h = part.Parent:FindFirstChild("Humanoid")
if h then
if val.Value == true then
if part.Parent.TeamColor.Value ~= script.Parent.Parent.Parent.Parent.Parent.TeamColor.Value then
h.Health = 0
end
end
end
end
end
script.Parent.Touched:connect(touc)

5 comments
.Hit isn't an event :c
I actually have used it many times before, try lower casing it. If it doesn't work at all then blame Roblox updates.
I have tried it. That's how I know it doesn't work.
You can try replacing the .Hit even with .Touched. I realized the door you are talking about isn't a moving object meaning it can
*meaning it can't use the .Hit event. I still suggest you using the .Touched event.