Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why is TweenSize Acting Funky?

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

0

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.

1 answer

thats not how you tween there is alot that goes into it but heres what you can use for now and a link to more info

Link: https://www.youtube.com/watch?v=VVQzx6yamJU

Just copy/ paste link isn't working rn

Example:

 script.Parent.GoldAmount:TweenSize(UDim2.new(0,roundedgoldpercentsize,0), "In", "Linear",2, false)

2 comments

0

Also this channel is really good sometimes

0

Thank you for your response, but it doesn't change anything. Also, you don't need to include all of the other variables when Tweening unless you need them.

This discussion is preserved as it was. New answers, comments, and votes are closed.