Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is TweenSize Acting Funky?

Asked by 6 years ago

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)
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. Z_DC 104 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

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)
0
Also this channel is really good sometimes mattchew1010 396 — 6y
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. ZappleOfficial 35 — 6y
Ad

Answer this question