Wipe Health2011.rbxm #6
330
Health2011.rbxm
330
Health2011.rbxm
|
|
@ -5,332 +5,8 @@
|
|||
<Properties>
|
||||
<bool name="Disabled">false</bool>
|
||||
<Content name="LinkedSource"><null></null></Content>
|
||||
<string name="Name">GUI_Copy</string>
|
||||
<ProtectedString name="Source">script.HealthGUI:clone().Parent = game.StarterGui;
|
||||
script:remove();</ProtectedString>
|
||||
<bool name="archivable">true</bool>
|
||||
<string name="Name">Script</string>
|
||||
<ProtectedString name="Source">script:Remove()</ProtectedString>
|
||||
</Properties>
|
||||
<Item class="GuiMain" referent="RBX1">
|
||||
<Properties>
|
||||
<string name="Name">HealthGUI</string>
|
||||
<bool name="archivable">true</bool>
|
||||
</Properties>
|
||||
<Item class="Frame" referent="RBX2">
|
||||
<Properties>
|
||||
<bool name="Active">false</bool>
|
||||
<Color3 name="BackgroundColor3">4285215356</Color3>
|
||||
<float name="BackgroundTransparency">1</float>
|
||||
<Color3 name="BorderColor3">4279970357</Color3>
|
||||
<int name="BorderSizePixel">1</int>
|
||||
<string name="Name">tray</string>
|
||||
<UDim2 name="Position">
|
||||
<XS>0.5</XS>
|
||||
<XO>-44</XO>
|
||||
<YS>1</YS>
|
||||
<YO>-26</YO>
|
||||
</UDim2>
|
||||
<UDim2 name="Size">
|
||||
<XS>0</XS>
|
||||
<XO>170</XO>
|
||||
<YS>0</YS>
|
||||
<YO>18</YO>
|
||||
</UDim2>
|
||||
<token name="SizeConstraint">2</token>
|
||||
<token name="Style">0</token>
|
||||
<bool name="Visible">true</bool>
|
||||
<int name="ZIndex">1</int>
|
||||
<bool name="archivable">true</bool>
|
||||
</Properties>
|
||||
<Item class="ImageLabel" referent="RBX3">
|
||||
<Properties>
|
||||
<bool name="Active">false</bool>
|
||||
<Color3 name="BackgroundColor3">4294967295</Color3>
|
||||
<float name="BackgroundTransparency">1</float>
|
||||
<Color3 name="BorderColor3">4279970357</Color3>
|
||||
<int name="BorderSizePixel">1</int>
|
||||
<Content name="Image"><url>rbxasset://textures/healthgui/bkg.png</url></Content>
|
||||
<string name="Name">bkg</string>
|
||||
<UDim2 name="Position">
|
||||
<XS>0</XS>
|
||||
<XO>0</XO>
|
||||
<YS>0</YS>
|
||||
<YO>0</YO>
|
||||
</UDim2>
|
||||
<UDim2 name="Size">
|
||||
<XS>1</XS>
|
||||
<XO>0</XO>
|
||||
<YS>1</YS>
|
||||
<YO>0</YO>
|
||||
</UDim2>
|
||||
<token name="SizeConstraint">0</token>
|
||||
<bool name="Visible">true</bool>
|
||||
<int name="ZIndex">1</int>
|
||||
<bool name="archivable">true</bool>
|
||||
</Properties>
|
||||
</Item>
|
||||
<Item class="ImageLabel" referent="RBX4">
|
||||
<Properties>
|
||||
<bool name="Active">false</bool>
|
||||
<Color3 name="BackgroundColor3">4294967295</Color3>
|
||||
<float name="BackgroundTransparency">1</float>
|
||||
<Color3 name="BorderColor3">4279970357</Color3>
|
||||
<int name="BorderSizePixel">1</int>
|
||||
<Content name="Image"><url>rbxasset://textures/healthgui/BarRed.png</url></Content>
|
||||
<string name="Name">barRed</string>
|
||||
<UDim2 name="Position">
|
||||
<XS>0.0189999994</XS>
|
||||
<XO>0</XO>
|
||||
<YS>0.100000001</YS>
|
||||
<YO>0</YO>
|
||||
</UDim2>
|
||||
<UDim2 name="Size">
|
||||
<XS>0</XS>
|
||||
<XO>0</XO>
|
||||
<YS>0</YS>
|
||||
<YO>0</YO>
|
||||
</UDim2>
|
||||
<token name="SizeConstraint">0</token>
|
||||
<bool name="Visible">true</bool>
|
||||
<int name="ZIndex">1</int>
|
||||
<bool name="archivable">true</bool>
|
||||
</Properties>
|
||||
</Item>
|
||||
<Item class="Frame" referent="RBX5">
|
||||
<Properties>
|
||||
<bool name="Active">false</bool>
|
||||
<Color3 name="BackgroundColor3">4294967295</Color3>
|
||||
<float name="BackgroundTransparency">1.00000012</float>
|
||||
<Color3 name="BorderColor3">4279970357</Color3>
|
||||
<int name="BorderSizePixel">0</int>
|
||||
<string name="Name">bar2</string>
|
||||
<UDim2 name="Position">
|
||||
<XS>0.0189999994</XS>
|
||||
<XO>0</XO>
|
||||
<YS>0.100000001</YS>
|
||||
<YO>0</YO>
|
||||
</UDim2>
|
||||
<UDim2 name="Size">
|
||||
<XS>0.192000002</XS>
|
||||
<XO>0</XO>
|
||||
<YS>0.829999983</YS>
|
||||
<YO>0</YO>
|
||||
</UDim2>
|
||||
<token name="SizeConstraint">0</token>
|
||||
<token name="Style">0</token>
|
||||
<bool name="Visible">true</bool>
|
||||
<int name="ZIndex">1</int>
|
||||
<bool name="archivable">true</bool>
|
||||
</Properties>
|
||||
<Item class="Script" referent="RBX6">
|
||||
<Properties>
|
||||
<bool name="Disabled">false</bool>
|
||||
<Content name="LinkedSource"><null></null></Content>
|
||||
<string name="Name">Script</string>
|
||||
<ProtectedString name="Source">h = script.Parent.Parent.Parent.Parent.Parent.Character.Humanoid
|
||||
tray = script.Parent.Parent
|
||||
base = tray.Parent
|
||||
local lastHealth = 100
|
||||
local lastHealth2 = 100
|
||||
local maxWidth = 0.96
|
||||
|
||||
function UpdateGUI(health)
|
||||
local width = (health / h.MaxHealth) * maxWidth
|
||||
local height = 0.83
|
||||
local lastX = tray.bar.Position.X.Scale
|
||||
local x = 0.019 + (maxWidth - width)
|
||||
local y = 0.1
|
||||
|
||||
tray.bar.Position = UDim2.new(x,0,y, 0)
|
||||
tray.bar.Size = UDim2.new(width, 0, height, 0)
|
||||
-- If more than 1/4 health, bar = green. Else, bar = red.
|
||||
if( (health / h.MaxHealth) > 0.25 ) then
|
||||
tray.barRed.Size = UDim2.new(0, 0, 0, 0)
|
||||
else
|
||||
tray.barRed.Position = tray.bar.Position
|
||||
tray.barRed.Size = tray.bar.Size
|
||||
tray.bar.Size = UDim2.new(0, 0, 0, 0)
|
||||
end
|
||||
|
||||
if ( (lastHealth - health) > (h.MaxHealth / 10) ) then
|
||||
lastHealth = health
|
||||
|
||||
if h.Health ~= h.MaxHealth then
|
||||
delay(0,function()
|
||||
AnimateHurtOverlay()
|
||||
end)
|
||||
delay(0,function()
|
||||
AnimateBars(x, y, lastX, height)
|
||||
end)
|
||||
end
|
||||
else
|
||||
lastHealth = health
|
||||
end
|
||||
end
|
||||
|
||||
function AnimateBars(x, y, lastX, height)
|
||||
local width = math.abs(x - lastX)
|
||||
if( x > lastX ) then
|
||||
x = lastX
|
||||
end
|
||||
tray.bar2.Position = UDim2.new(x,0, y, 0)
|
||||
tray.bar2.Size = UDim2.new(width, 0, height, 0)
|
||||
tray.bar2.BackgroundTransparency = 0
|
||||
local GBchannels = 1
|
||||
local j = 0.2
|
||||
|
||||
local i_total = 30
|
||||
for i=1,i_total do
|
||||
-- Increment Values
|
||||
if (GBchannels < 0.2) then
|
||||
j = -j
|
||||
end
|
||||
GBchannels = GBchannels + j
|
||||
if (i > (i_total - 10)) then
|
||||
tray.bar2.BackgroundTransparency = tray.bar2.BackgroundTransparency + 0.1
|
||||
end
|
||||
tray.bar2.BackgroundColor3 = Color3.new(1, GBchannels, GBchannels)
|
||||
|
||||
wait(0.02)
|
||||
end
|
||||
end
|
||||
|
||||
function AnimateHurtOverlay()
|
||||
-- Start:
|
||||
-- overlay.Position = UDim2.new(0, 0, 0, -22)
|
||||
-- overlay.Size = UDim2.new(1, 0, 1.15, 30)
|
||||
|
||||
-- Finish:
|
||||
-- overlay.Position = UDim2.new(-2, 0, -2, -22)
|
||||
-- overlay.Size = UDim2.new(4.5, 0, 4.65, 30)
|
||||
|
||||
overlay = base.hurtOverlay
|
||||
overlay.Visible = true
|
||||
overlay.Position = UDim2.new(-2, 0, -2, -22)
|
||||
overlay.Size = UDim2.new(4.5, 0, 4.65, 30)
|
||||
-- Animate In, fast
|
||||
local i_total = 2
|
||||
local wiggle_total = 0
|
||||
local wiggle_i = 0.02
|
||||
for i=1,i_total do
|
||||
overlay.Position = UDim2.new( (-2 + (2 * (i/i_total)) + wiggle_total/2), 0, (-2 + (2 * (i/i_total)) + wiggle_total/2), -22 )
|
||||
overlay.Size = UDim2.new( (4.5 - (3.5 * (i/i_total)) + wiggle_total), 0, (4.65 - (3.5 * (i/i_total)) + wiggle_total), 30 )
|
||||
wait(0.01)
|
||||
end
|
||||
|
||||
i_total = 30
|
||||
|
||||
wait(0.03)
|
||||
|
||||
-- Animate Out, slow
|
||||
for i=1,i_total do
|
||||
if( math.abs(wiggle_total) > (wiggle_i * 3) ) then
|
||||
wiggle_i = -wiggle_i
|
||||
end
|
||||
wiggle_total = wiggle_total + wiggle_i
|
||||
overlay.Position = UDim2.new( (0 - (2 * (i/i_total)) + wiggle_total/2), 0, (0 - (2 * (i/i_total)) + wiggle_total/2), -22 )
|
||||
overlay.Size = UDim2.new( (1 + (3.5 * (i/i_total)) + wiggle_total), 0, (1.15 + (3.5 * (i/i_total)) + wiggle_total), 30 )
|
||||
wait(0.01)
|
||||
end
|
||||
|
||||
-- Hide after we're done
|
||||
overlay.Position = UDim2.new(10, 0, 0, 0)
|
||||
overlay.Visible = false
|
||||
end
|
||||
|
||||
h.Changed:connect(function()
|
||||
UpdateGUI(h.Health)
|
||||
if ( (lastHealth2 - h.Health) > (h.MaxHealth / 10) ) then
|
||||
lastHealth2 = h.Health
|
||||
else
|
||||
lastHealth2 = h.Health
|
||||
end end)
|
||||
</ProtectedString>
|
||||
<bool name="archivable">true</bool>
|
||||
</Properties>
|
||||
</Item>
|
||||
</Item>
|
||||
<Item class="ImageLabel" referent="RBX7">
|
||||
<Properties>
|
||||
<bool name="Active">false</bool>
|
||||
<Color3 name="BackgroundColor3">4294967295</Color3>
|
||||
<float name="BackgroundTransparency">1</float>
|
||||
<Color3 name="BorderColor3">4279970357</Color3>
|
||||
<int name="BorderSizePixel">1</int>
|
||||
<Content name="Image"><url>rbxasset://textures/healthgui/Bar.png</url></Content>
|
||||
<string name="Name">bar</string>
|
||||
<UDim2 name="Position">
|
||||
<XS>0.0189999994</XS>
|
||||
<XO>0</XO>
|
||||
<YS>0.100000001</YS>
|
||||
<YO>0</YO>
|
||||
</UDim2>
|
||||
<UDim2 name="Size">
|
||||
<XS>0.959999979</XS>
|
||||
<XO>0</XO>
|
||||
<YS>0.829999983</YS>
|
||||
<YO>0</YO>
|
||||
</UDim2>
|
||||
<token name="SizeConstraint">0</token>
|
||||
<bool name="Visible">true</bool>
|
||||
<int name="ZIndex">1</int>
|
||||
<bool name="archivable">true</bool>
|
||||
</Properties>
|
||||
</Item>
|
||||
<Item class="ImageLabel" referent="RBX8">
|
||||
<Properties>
|
||||
<bool name="Active">false</bool>
|
||||
<Color3 name="BackgroundColor3">4294967295</Color3>
|
||||
<float name="BackgroundTransparency">1</float>
|
||||
<Color3 name="BorderColor3">4279970357</Color3>
|
||||
<int name="BorderSizePixel">0</int>
|
||||
<Content name="Image"><url>rbxasset://textures/healthgui/label.png</url></Content>
|
||||
<string name="Name">label</string>
|
||||
<UDim2 name="Position">
|
||||
<XS>0.680000007</XS>
|
||||
<XO>0</XO>
|
||||
<YS>0.300000012</YS>
|
||||
<YO>0</YO>
|
||||
</UDim2>
|
||||
<UDim2 name="Size">
|
||||
<XS>0.25</XS>
|
||||
<XO>0</XO>
|
||||
<YS>0.349999994</YS>
|
||||
<YO>0</YO>
|
||||
</UDim2>
|
||||
<token name="SizeConstraint">0</token>
|
||||
<bool name="Visible">true</bool>
|
||||
<int name="ZIndex">1</int>
|
||||
<bool name="archivable">true</bool>
|
||||
</Properties>
|
||||
</Item>
|
||||
</Item>
|
||||
<Item class="ImageLabel" referent="RBX9">
|
||||
<Properties>
|
||||
<bool name="Active">false</bool>
|
||||
<Color3 name="BackgroundColor3">4290164919</Color3>
|
||||
<float name="BackgroundTransparency">1</float>
|
||||
<Color3 name="BorderColor3">4279970357</Color3>
|
||||
<int name="BorderSizePixel">1</int>
|
||||
<Content name="Image"><url>rbxasset://textures/healthgui/HurtOverlay.png</url></Content>
|
||||
<string name="Name">hurtOverlay</string>
|
||||
<UDim2 name="Position">
|
||||
<XS>2</XS>
|
||||
<XO>0</XO>
|
||||
<YS>0</YS>
|
||||
<YO>-22</YO>
|
||||
</UDim2>
|
||||
<UDim2 name="Size">
|
||||
<XS>1</XS>
|
||||
<XO>0</XO>
|
||||
<YS>1.1500001</YS>
|
||||
<YO>30</YO>
|
||||
</UDim2>
|
||||
<token name="SizeConstraint">0</token>
|
||||
<bool name="Visible">false</bool>
|
||||
<int name="ZIndex">1</int>
|
||||
<bool name="archivable">true</bool>
|
||||
</Properties>
|
||||
</Item>
|
||||
</Item>
|
||||
</Item>
|
||||
</roblox>
|
||||
</roblox>
|
||||
|
|
|
|||
Loading…
Reference in New Issue