Help with tweening gui

I want to tween an ultimate bar for a fighting game, and make its x offset the value of a number value, i checked the number value and it changes, but i dont know how to script the tween for the gui, here is my script that I have issues with

local plr = game.Players.LocalPlayer
plr.CharacterAdded:Wait()
local char = plr.Character
local gui = script.Parent
local ultmeter = char:WaitForChild("UltMeter")
local value

game:GetService("RunService").Heartbeat:Connect(function()
	value = ultmeter.Value
	game:GetService("RunService").Heartbeat:Wait()
end)


game:GetService("RunService").Heartbeat:Connect(function()
	gui:TweenSize(UDim2.new(0, value, 60, 0),"In","Linear",0.3)
	game:GetService("RunService").Heartbeat:Wait()
end)

1 Like

Fixed it by removing the 2 functions and replacing them with this function

ultmeter:GetPropertyChangedSignal("Value"):Connect(function()
	local value = ultmeter.Value
	gui:TweenSize(UDim2.new(0, value, 0, 60),"In","Linear",0.2)
	print("update gui size")
end)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.