Problem: The Following script will not change the size of the bar(a frame) when value changes, I have checked while playing in studio and the Value DOES change. It is a number value
No output Errors
I debuged It and it stops printing at Val.Changed/Bar:Tween
Update: I have now found out that it does fire the function when the value changes but the gui does not tween, this script is in the frame I want to tween, yes I have tried to use script. Parent
Script
local Val = script.Parent.Parent:WaitForChild('MyThirst') local Bar = script.Parent local Size = .02 * Val.Value Val.Changed:connect(function(NewValue) Bar:TweenSize(UDim2.new(.02 * NewValue, 0,0.44, 0)) end)
I have also tried
local Val = script.Parent.Parent.MyThirst local Bar = script.Parent local Size = .02 * Val.Value Val.Changed:connect(function(NewValue) Bar:TweenSize(UDim2.new(Size, 0,0.44, 0)) end)
Also tried
local Val = script.Parent.Parent:WaitForChild('MyThirst') local Bar = script.Parent local Size = .02 * Val.Value Val.Changed:connect(function(NewValue) Bar:TweenSize(UDim2.new(.02 * NewValue, 0,0.44, 0),1) end)
(Although answered through Kobra.io), If it's a script, convert to local. Tweening and Gui editing works through Localscript.
ROBLOX Wiki : You probably want to use a LocalScript for GUI tweening
From what I understand about Tweening, you need to provide an EasingStyle as well as a time and Direction. So the line of code that controls the TweenSize should look like this:
Bar:TweenSize(UDim2.new(.02 * NewValue, 0,0.44, 0), "Out", "Quad", 1)
I could be completely wrong though. If it doesnt work, sorry. Thats all I can think of.