x = script.Parent.Parent.Terminal
if script.Parent.Humanoid.Health < 1 then msg = Instance.new("Message") msg.Parent = game.Workspace msg.Text = "The (Team Name) Has Won!" x:remove() wait(5) msg:remove() script.Parent:remove() end
Alright, so here is my intent for this script. This is inside a model with a humanoid. When the humanoid's health gets to 0, I'm trying to make it display a message saying a certain team has won, and then it is supposed to delete a similar model that has a different name. For some reason, though, this isn't happening when make it's health 0. Can someone explain why?
You were only checking once to see if the health was less than 1. I also optimized some of your other code.
local x = script.Parent.Parent.Terminal script.Parent.Humanoid.Died:connect(function() msg = Instance.new("Message",Workspace) msg.Text = "The (Team Name) Has Won!" x:Destroy() Game.Debris:AddItem(msg,5) wait(5) script.Parent:remove() end)