Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How can I make my Battery Bar go the other way? (TweenSize)

Asked by 2 years ago

I've got this monitor which shows my Battery levels and it like the Battery bar to go down, but it just goes the wrong way, it does this what I'm after is for it to go down instead of up.

Here's my code:

P.S I'm a complete noob to anything related to Tween.

workspace.Main.Battery:GetPropertyChangedSignal("Value"):Connect(function()
    local battery = workspace.Main.Battery.Value * 5.1 
    -- Battery is at 100 by default and can be drained by another source, and the multiply is to make the Value match up with the Bar size.
    workspace.Console.Monitor1.Movement.Screen.SurfaceGui.progressbattbar:TweenSize(UDim2.new(0, 120,0, battery),"InOut","Sine",6)
    print("Battery has changed.")


    -- Change color the lower the battery gets.
    if workspace.Main.Battery.Value > 50 then
        workspace.Console.Monitor1.Movement.Screen.SurfaceGui.progressbattbar.ImageColor3 = Color3.fromRGB(0, 255, 0)
    end

    if workspace.Main.Battery.Value <= 50 then
        workspace.Console.Monitor1.Movement.Screen.SurfaceGui.progressbattbar.ImageColor3 = Color3.fromRGB(255, 150, 0)
    end

    if workspace.Main.Battery.Value <= 25 then
        workspace.Console.Monitor1.Movement.Screen.SurfaceGui.progressbattbar.ImageColor3 = Color3.fromRGB(255, 0, 0)
    end
end)

1 answer

Log in to vote
0
Answered by 2 years ago

Change the GuiObject.AnchorPoint property so that the Y of the Vector2 is 1.

0
It works thanks! jaydenrobloxreviewer 9 — 2y
Ad

Answer this question