Tweening Size issue

Hello! I am having an issue with a stamina bar here when you run the bar goes out of the mainframe and changes size can someone help?


--local Bar = script.Parent:WaitForChild('Background'):WaitForChild('Bar')



local player = game.Players.LocalPlayer

local NormalWalkSpeed = 16
local NewWalkSpeed = 30

local power = 10

local sprinting = false

repeat wait() until game.Players.LocalPlayer.Character

local character = player.Character

local humanoid = character:WaitForChild("Humanoid")

local Bar = player.PlayerGui.MainFrame.SprintFrame.Sprint



local Player = game.Players.LocalPlayer
local Track1 = Player.Character.Humanoid:LoadAnimation(script.Run)

UIS.InputBegan:connect(function(key, gameProcessed)
	if key.KeyCode == Enum.KeyCode.LeftShift and gameProcessed == false then
		character.Humanoid.WalkSpeed = NewWalkSpeed
		sprinting = true
		while power > 0 and sprinting do
			
			Track1:Play()
			
			power = power - 0.050

			local change = power / 10


			Bar:TweenSize(UDim2.new(change , 0,1,0),"In","Linear",0.1)
		
			--Bar:TweenSize(UDim2.new(power / 0, 1, 0))
			--Bar.BackgroundColor3 = Bar.BackgroundColor3:lerp(Color3.fromRGB(255, 42, 42), 0.001)
			wait()
			if power <= 0 then
				if Track1 then
					Track1:Stop()
				end
				character.Humanoid.WalkSpeed = NormalWalkSpeed
			end
		end
	end
end)

UIS.InputEnded:connect(function(key, gameProcessed)
	if key.KeyCode == Enum.KeyCode.LeftShift and gameProcessed == false then
		character.Humanoid.WalkSpeed = NormalWalkSpeed
		sprinting = false
		while power < 10 and not sprinting do
			power = power + .025
			Bar:TweenSize(UDim2.new(power / 10.9, 0, 0.5, 0), 'Out', 'Quint', .1, true)
			Track1:Stop()
			--Bar.BackgroundColor3 = Bar.BackgroundColor3:lerp(Color3.fromRGB(255, 166, 11), 0.001)
			wait()
			if power <= 0 then
				character.Humanoid.WalkSpeed = NormalWalkSpeed
			end
		end
	end
end)

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

where exactly do i put this ???