Basically there is no issue with this code, everything runs. When the ammo of the weapon is changed then the gui resizes (basically a bar that shrinks according to ammo). The issue I am having is when the bar resizes it does so inwards, I only want the y axis shrinking but the x axes does too towards the top right corner (even though my argument for the tweensize has the same x value as the original???).
My other problem is a large amount of lag whenever I fire a gun, is this script the issue? Can anyone provide a different way of doing the gui that shrinks when the gun is fired?
Anyway, here's the code. Questions/tldr: What can I do to stop it shrinking towards the top right corner as a-pose to just up and down, is there a different way of doing this (reaching the same result) but easier?
player = game.Players.LocalPlayer
ammo = player:FindFirstChild("Ammo",true)
tool = script.Parent
tool.Size = UDim2.new(0,30,0,149)
while true do
wait()
if ammo then
ammo.Changed:connect(function()
existing = script.Parent.Size
script.Parent:TweenSize(UDim2.new(0,30,0,(ammo.Value * 4.97)), "Out", "Quad", 1)
wait(0.2)
end)
end
end

1 comment
Thanks for that!