|
| 02 Apr 2014 10:13 PM |
I am trying to make a script that when a player dies, a GUI message is shown. There is no output...
player = game.Players.LocalPlayer playerN = player.Name i2 = game.Workspace.Info2 Humanoid = player.Character.Humanoid
repeat wait() until player and Humanoid if Humanoid.Health == 0 then i2.Value = ""..playerN.." has been defeated!" script:remove() end |
|
|
| Report Abuse |
|
|
|
| 02 Apr 2014 10:16 PM |
| For the information, it is a LocalScript in StarterGui. |
|
|
| Report Abuse |
|
|
|
| 02 Apr 2014 10:25 PM |
local player = game.Players.LocalPlayer local playerN = player.Name i2 = game.Workspace.Info2 local Humanoid = player.Character:WaitForChild("Humanoid")
repeat wait() until Humanoid ~= nil if Humanoid.Health == 0 then i2.Value = ""..playerN.." has been defeated!" script:remove() end
Make sure the script is getting into the playergui, backpack, or something. |
|
|
| Report Abuse |
|
|
|
| 02 Apr 2014 10:30 PM |
| It did not work, and I even put it in the StarterGui to start with! |
|
|
| Report Abuse |
|
|
|
| 02 Apr 2014 10:32 PM |
local player = game.Players.LocalPlayer local playerN = player.Name local i2 = game.Workspace.Info2
repeat wait() until player.Character player.Character:WaitForChild("Humanoid").Died:connect(function() i2.Value = player.Name .. " has been defeated!"; end) |
|
|
| Report Abuse |
|
|
|
| 02 Apr 2014 10:35 PM |
| Wow, math. Such skill. So works. |
|
|
| Report Abuse |
|
|