So this chunk of script is running ina LocalScript and is triggered by a RemoteEvent (as shown) tht is fired in a script in ServerScriptService. The part that I'm emphasizing is the area that is using TweenSize. For some reason, it only works sometimes, and randomly. Any clue or ideas why?
game.ReplicatedStorage.StatsRemote.OnClientEvent:connect(function(wood,gold)
local woodpercent = wood / maxwood.Value
local woodpercentsize = woodpercent * 280
local roundedwoodpercentsize = math.floor(woodpercentsize+.5)
local goldpercent = gold / maxgold.Value
local goldpercentsize = goldpercent * 280
local roundedgoldpercentsize = math.floor(goldpercentsize+.5)
script.Parent.WoodAmount:TweenSize(UDim2.new(0,roundedwoodpercentsize,0,40))
script.Parent.GoldAmount:TweenSize(UDim2.new(0,roundedgoldpercentsize,0,40))
end)

1 comment
I suggest using TweenService for any tweening you want to do... Also connect is depricated, use Connect. I would also suggest trying to print the variables "roundedwoodpercentsize" and "roundedgoldpercentsize" to see if they are not giving correct values.