|
| 25 May 2015 05:03 PM |
Not sure if i should use the same thread for a diff issue on same subject..?
heres my code, anyways it goes out of the whole screen. I want maybe 1/10 of that size.
Heres my code:
local Players = game:GetService("Players")
repeat wait() until Players.LocalPlayer and Players.LocalPlayer.Character
local Humanoid = Players.LocalPlayer.Character:WaitForChild("Humanoid")
local HealthFrame = script.Parent:WaitForChild("HealthFrame") local HealthLabel = script.Parent:WaitForChild("HealthAmountLabel")
Humanoid.HealthChanged:connect(function() HealthLabel.Text = "Health: "..math.ceil(Humanoid.Health).."/"..math.ceil(Humanoid.MaxHealth) HealthFrame.Size = UDim2.new(Humanoid.Health/Humanoid.MaxHealth,0,.05,0) HealthFrame.Position = UDim2.new(.5,-HealthFrame.AbsoluteSize.X/2,.925,0) end) |
|
|
| Report Abuse |
|
|
RedX8
|
  |
| Joined: 02 Jun 2010 |
| Total Posts: 839 |
|
|
| 25 May 2015 05:06 PM |
| So it seems you're looking for the formula to get the percentage of the Health, and MaxHealth? This will make it fit in a specified size, and still be dynamic. |
|
|
| Report Abuse |
|
|
|
| 25 May 2015 05:07 PM |
Uh i didnt quite understand that. Basically i want to scale the size it sets it to to that /10.
FOr some reason its fitting the whole screen o3o. |
|
|
| Report Abuse |
|
|
RedX8
|
  |
| Joined: 02 Jun 2010 |
| Total Posts: 839 |
|
|
| 25 May 2015 05:08 PM |
| (Health / MaxHealth) * SpecifiedSize |
|
|
| Report Abuse |
|
|
RedX8
|
  |
| Joined: 02 Jun 2010 |
| Total Posts: 839 |
|
|
| 25 May 2015 05:12 PM |
Example: (25 / 100) = 0.25 0.25 * (200 pixels in size) = 50
So 50 is 1/4 of the size of 200 pixels. |
|
|
| Report Abuse |
|
|
|
| 25 May 2015 05:17 PM |
i figured it out.
It was the X Size of the gui, so *.2 |
|
|
| Report Abuse |
|
|
RedX8
|
  |
| Joined: 02 Jun 2010 |
| Total Posts: 839 |
|
|
| 25 May 2015 05:21 PM |
| Yes, the X Coordinate you want to change, but I would suggest not using .2 as your size in pixels, unless i'm mistaken, and the size is not in pixels, but in units. |
|
|
| Report Abuse |
|
|
| |
|