im trying to tween the purple bar so that it goes down, however as u can see int he video that is not the case, I’m not sure how to tween the bar so that it goes down rather then moving to the left.
local TW = game:GetService("TweenService")
local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local BusoHakiBar = script.Parent
local function UpdateBusoHakibar()
local Haki = math.clamp(Character:GetAttribute("BusoHakiTime") / Character:GetAttribute("MaxBusoHakiTime"), 0, 1)
local info = TweenInfo.new(Character:GetAttribute("BusoHakiTime") / Character:GetAttribute("MaxBusoHakiTime"),Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0)
TW:Create(script.Parent,info,{Size = UDim2.fromScale(Haki, 1)}):Play()
end
Character:GetAttributeChangedSignal("BusoHakiTime"):Connect(UpdateBusoHakibar)
You should use your frame’s anchorpoint property. Since you want it going down, you should make your anchor point 0.5, 1. Although, by configuring your anchorpoint, you’ll have to adjust your frame position again.
its much better now however the bar contracts rather then going down, like how would I make it so that it goes from the top and reduces to the bottom rather then from reducing from both sides and meeting at the middle.
I think that this issue is being caused by how your UI is structured, rather than an issue with your code. I recommend doing something like this (arrows indicate that it’s a child):
Base Frame (only rotate and position this frame)
→ Purple bar
→ ImageLabel that contains the stripes (make sure that its ZIndex is higher than the one being used by the purple bar)
->-> TextLabel
You also won’t need to worry about the anchor points of any GUI other than the base frame
Make note of the properties on the Frame parent (and its parent) of the LocalScript. Like @JohhnyLegoKing said, it’s more likely that your UI structure/properties have led to some issues with your scaling than has the current tweening.
If the changes were set accordingly, it may be a problem with the setting of the gui itself instead… Try using @JohhnyLegoKing 's suggestion. Although, I’m pretty sure the purple bar should also have an anchorpoint since it’s the one supposed to be moving, and not the base frame. But pretty much, everything else he said is correct.
I would use AnchorPoint properties when there are multiple objects that need to be adjusted when the health meter changes. I haven’t used UIListLayouts recently so I’m just wondering: have you found a better way to make a progress bar with multiple changing features? Whether that be a “buffer” color between what is lost and what the current bar is at or overlaying two different stats in one bar.
guys… i tried for a couple of days, but nothing seems to work, its clear that it is my gui formating.
here is the surface GUI, can someone fix my GUI formatting? (would be nice if the size was the same SurfaceGui.rbxm (10.2 KB)
I checked the place file that you’ve provided, and I noticed a very important detail: You’re using a BillboardGui, not a ScreenGui. BillboardGuis scale their children in a different way than ScreenGuis, as it’s dependent on the stud size of its adornee:
-- Needs to be a LocalScript that's a direct child of the ScreenGui
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local Workspace = game:GetService("Workspace")
local OFFSET = Vector3.new(2, 0, 0) -- The offset, in studs, for your GUI relative to the player's root part
local camera = Workspace.CurrentCamera or Workspace:WaitForChild("Camera")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local rootPart = character.PrimaryPart or character:WaitForChild("HumanoidRootPart")
local gui = script.Parent
local base = gui:WaitForChild("Base") -- Make sure that the name matches the one you're using, otherwise an error will occur
local function onHeartbeat()
local rootPosition = rootPart.Position + OFFSET
local screenPoint = camera:WorldToScreenPoint(rootPosition) -- You'll need to use WorldToViewportPoint if you're ignoring the topbar offset
base.Position = UDim2.fromOffset(screenPoint.X, screenPoint.Y)
end
RunService.Heartbeat:Connect(onHeartbeat)