Ipuo
|
  |
| Joined: 24 Nov 2014 |
| Total Posts: 11 |
|
|
| 29 Nov 2014 05:38 AM |
Please tell me how add custom health bar script. I remove standard health bar. I make: Screen Gui (in Starter Gui) > make Frame and put green color > now please tell me script.
|
|
|
| Report Abuse |
|
|
Ipuo
|
  |
| Joined: 24 Nov 2014 |
| Total Posts: 11 |
|
|
| 29 Nov 2014 05:48 AM |
wait(0.5) local char = script.Parent.Parent.Parent.Character hum = char.Humanoid hum.Changed:connect(function() script.Parent.Frame.Health.Frame.Size = UDim2.new(hum.Health/hum.MaxHealth,0,1,0) script.Parent.Frame.Text.TextLabel.Text = ""..hum.Health.."/"..hum.MaxHealth.."" if hum.Health <= hum.MaxHealth*0.25 then script.Parent.Frame.Health.Frame.BackgroundColor3 = Color3.new(255,0,0) else script.Parent.Frame.Health.Frame.BackgroundColor3 = Color3.new(0,255,0) end end)
This is not work. I dont know what to make bad. |
|
|
| Report Abuse |
|
|
|
| 29 Nov 2014 09:10 AM |
1. Remove Default Health Gui 2. Screen Gui 3. Frame 4. Position a background frame and modify to your liking 5. Add another frame with the size being (.001, 0, 1 ,0) so that this will be at the uttermost left of the first frame 6. Change the background color to the color you would like the health to be 7. Insert script into 2nd frame 8. Inside script:
while true do wait (0.01) script.Parent.Size = UDim2.new((HumanoidHealth/HumanoidMaxHealth), 0 , 1 , 0 ) end
I didn't test it though. |
|
|
| Report Abuse |
|
|
|
| 29 Nov 2014 09:42 AM |
You seem to have missed some periods there to get the property of Humanoid @Geo
And that seems rather inefficient when you could do this:
Humanoid.Changed:connect(function() --stuff end) |
|
|
| Report Abuse |
|
|
|
| 29 Nov 2014 10:17 AM |
| Color3s support values between 0 and 1, they don't go up to 255. |
|
|
| Report Abuse |
|
|
Ipuo
|
  |
| Joined: 24 Nov 2014 |
| Total Posts: 11 |
|
|
| 29 Nov 2014 10:39 AM |
Its dont work.
Humanoid.Changed:connect(function() while true do wait (0.01) script.Parent.Size = UDim2.new((HumanoidHealth/HumanoidMaxHealth), 0 , 1 , 0 ) end
I have problem in frame with size. I put .001, 0, 1 ,0 and system put 0.001,0 how change size? This is formula from studio: {0,0}{0,0}
|
|
|
| Report Abuse |
|
|
Ipuo
|
  |
| Joined: 24 Nov 2014 |
| Total Posts: 11 |
|
| |
|