I have an overhead hp bar for an rpg and you can clearly see that there is studs on the hp bar. how would i make this property "smooth" instead of "studs" by adding some lines of script?
print 'Hello world!'
--Created by XanthicDragon
--Inspired by "Sword Art Online: Burst"
game:GetService("StarterGui"):SetCoreGuiEnabled("Health", false)
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Character
repeat
wait()
Character = Player.Character
until Character
local Human = Character:WaitForChild("Humanoid")
coroutine.resume(coroutine.create(function ()
while wait() do
if Character:findFirstChild("Health") then
Character.Health.Disabled = true
end
end
end))
local red = Instance.new("Part", Character)
red.Material = "Plastic"
red.BrickColor = BrickColor.Red()
red.FormFactor = "Custom"
red.Size = Vector3.new(4, 0.5, 0.5)
red.Anchored = true
local green = Instance.new("Part", Character)
green.Material = "Plastic"
green.BrickColor = BrickColor.new("Lime green")
green.FormFactor = "Custom"
green.Size = Vector3.new(1, 0.5, 0.5)
green.Anchored = true
local gmesh = Instance.new("BlockMesh", green)
gmesh.Scale = Vector3.new(4, 1.2, 1.2)
local angle = 0
game:GetService("RunService").RenderStepped:connect(function ()
angle = angle + 3
local MH = Human.MaxHealth
local HP = Human.Health
if MH ~= math.huge then
if HP < MH then
Human.Health = Human.Health + 0.05
end
green.BrickColor = BrickColor.new("Lime green")
gmesh.Scale = Vector3.new(((HP/MH)*4)+0.05, 1.05, 1.05)
gmesh.Offset = Vector3.new((HP/MH)*2, 0, 0)
red.CFrame = Character.Head.CFrame * CFrame.new(0, 2, 0) * CFrame.Angles(math.rad(angle), 0, 0)
green.CFrame = red.CFrame * CFrame.new(-2, 0, 0)
else
green.BrickColor = BrickColor.Yellow()
gmesh.Scale = Vector3.new(4.05, 1.05, 1.05)
gmesh.Offset = Vector3.new(2, 0, 0)
red.CFrame = Character.Head.CFrame * CFrame.new(0, 2, 0) * CFrame.Angles(math.rad(angle), 0, 0)
green.CFrame = red.CFrame * CFrame.new(-2, 0, 0)
end
end)
