How to I change a position base on a value?

So the mag is empty right, and it looks like this.


The mag is full, it looks like this.

How do I make the holder thing and the spring change it’s position based on a number value?(ammo count)

So like when it’s half full, the holder and spring are slightly tilted, and the spring is shrunk down?

Hello idk if this is good enough but i tested it and it worked well.

I used maxammo current ammo and maxsize for the mag itself its pretty easy to change and understand.

Here is the file itself change current ammo and it should do the size thingy.

You just have to make size script does other max ammo thingy itself so no worries while changing and integrating it to any type of guns.

MagScritthingyimade.rbxm (43.4 KB)

Script itself:

script.Parent.CurrentAmmo.Changed:Connect(function(NewValue)
	local LeftAmmo = script.Parent.MaxAmmo.Value-NewValue
	local CikarilacakSize = script.Parent.MaxSize.Value/script.Parent.MaxAmmo.Value
	local Sonuc = CikarilacakSize * LeftAmmo
	print(Sonuc-script.Parent.Size.Y)
	script.Parent.Size = Vector3.new(script.Parent.Size.X,Sonuc,script.Parent.Size.Z)
end)

I finally escaped!

There’s one thing about it though, and it doesn’t go straight down. It rotates a bit and changes a bit on the (x or z?) axis.

you can add minimal rotation changes shouldnt be hard ig