I want to make hunger bar but in a circle. Kinda like the one in subnautica. (Image below)
How would I do this?
Either use a UI Corner instance or then use an image.
How does a subnautica hunger bar work?
Use ui Corner and aspect ratio for a Circle (the background). then make an image, completely white, and a shape of a pizza slice, preferably a pizza slice with 1/100 of the original circle size, then set the anchor point to the point, and use a command to duplicate it 99 more times, and setting an angle offset of 3.6 each time, also name each copy 1,2,3…100 (how Lua counts) or 0,1,2…99 if you prefer counting from zero (like most programming languages).
Perhaps this is what you’re looking for;
made by using a few tricks with clipdescendants and uigradient
local Value = script.Parent.Value
local RightHalf = script.Parent.RightHalf.Frame.UIGradient
local LeftHalf = script.Parent.LeftHalf.Frame.UIGradient
local DisplayText = script.Parent.Display.TextLabel
Value.Changed:Connect(function(UpdatedValue)
local ValueInDegrees = -UpdatedValue*3.6
RightHalf.Rotation = math.min(ValueInDegrees,-180)
LeftHalf.Rotation = math.max(ValueInDegrees+180,0)
DisplayText.Text = tostring(UpdatedValue)
end)
UI corners can be configured into circles which does make it much easier to use than an image as images can’t be easily configured. You could use an image and add a frame overlay with multiple frames; one for each hunger segment.
Could you possibly send that ui?
But at 0 it returned to maximum bar…
That was just a demonstration, I was just changing Value
to show how the bar looks
Oh ok. It looks great!
Have a good day!
It’s looks a little rough when it changes. Is it possible to tween it?
You can tween the Value that is linked to the function.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.