null
nil
-
false
Fixer
game:GetService("Players").PlayerAdded:connect(function(Player)
Player.CharacterAdded:connect(function(char)
if (Player.Character ~= nil) then
script.Health:clone().Parent = Player.Character
end
end)
Player.Changed:connect(function(Property)
if (Property=="Character") and (Player.Character~=nil) then
local Character=Player.Character
local Humanoid=Character:FindFirstChild("Humanoid")
if (Humanoid~=nil) then
Humanoid.Died:connect(function() delay(5,function() script.Health:clone().Parent = Player.Character end) end)
end
end
end)
end)
true
-
false
Health
--Responsible for regening a player's humanoid's health
function waitForChild(parent, childName)
local child = parent:findFirstChild(childName)
if child then return child end
while true do
child = parent.ChildAdded:wait()
if child.Name==childName then return child end
end
end
-- declarations
local Figure = script.Parent
local Head = waitForChild(Figure, "Head")
local Humanoid = waitForChild(Figure, "Humanoid")
local regening = false
-- regeneration
function regenHealth()
if regening then return end
regening = true
while Humanoid.Health < Humanoid.MaxHealth do
local s = wait(1)
local health = Humanoid.Health
if health > 0 and health < Humanoid.MaxHealth then
local newHealthDelta = 0.01 * s * Humanoid.MaxHealth
health = health + newHealthDelta
Humanoid.Health = math.min(health,Humanoid.MaxHealth)
end
end
if Humanoid.Health > Humanoid.MaxHealth then
Humanoid.Health = Humanoid.MaxHealth
end
regening = false
end
Humanoid.HealthChanged:connect(regenHealth)
true
-
false
Sorter
script.Health:clone().Parent = game.StarterGui
script.ResetCommand:clone().Parent = game.Workspace
script:remove()
true
-
Health
true
-
false
4285215356
1
4279970357
1
Tray
0.949999988
0
0.380000025
0
0.0450000018
0
0.340000004
0
0
0
true
1
true
-
false
4286892054
0
4278190080
0
HealthBar
0.420000017
0
0
0
0.159999996
0
0.800000012
0
0
0
true
2
true
-
false
Script
h = script.Parent.Parent.Parent.Parent.Parent.Character.Humanoid
h.Changed:connect(function()
script.Parent.Size = UDim2.new(0.2, 0, 0.8 * (h.Health / h.MaxHealth), 0)
script.Parent.Position = UDim2.new(0.4, 0, 0.8 * (1- (h.Health / h.MaxHealth)) , 0)
end)
true
-
false
4289733411
0
4278190080
0
HealthBarBacking
0.419999987
0
0
0
0.159999996
0
0.800000012
0
0
0
true
1
true
-
false
4294967295
1
4279970357
1
rbxasset://../../../shareddata/textures/health.png
ImageLabel
0
0
0.800000012
3
1
0
0.25
0
1
true
1
true
-
false
ResetCommand
function onChatted(msg, speaker)
source = string.lower(speaker.Name)
msg = string.lower(msg)
-- Note: This one is NOT caps sensitive
if msg == "!!!reset" then
speaker.Character.Humanoid.Health = 0
end
end
function onPlayerEntered(newPlayer)
newPlayer.Chatted:connect(function(msg) onChatted(msg, newPlayer) end)
end
game.Players.ChildAdded:connect(onPlayerEntered)
true