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

Gui Not Tweening?

Asked by 8 years ago

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)

0
Have you tried Val.Value.Changed LittleBigDeveloper 245 — 8y
0
Yes, I was told you weren't dapper to do that though TheTermaninator 45 — 8y

2 answers

Log in to vote
1
Answered by
rexbit 707 Moderation Voter
8 years ago

(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

Ad
Log in to vote
0
Answered by 8 years ago

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.

0
tried, did not work, thanks for trying... TheTermaninator 45 — 8y
0
Omg I am such a noob.. Totally forgot about local scripts xD The_Sink 77 — 8y

Answer this question