Script isnt detecting the correct position of UI?
Asked by
3 years ago Edited 3 years ago
When updating the position of a frame, tweening or not, the script checks the specific Y Scale value on the Frame to see if it doesn't equal the value it gets set to
The script initially is supposed to ignore the if statement, and go to the else statement meaning since the frame hasn't been tweened yet, and once another tween is called, the if statement clears the tween basically
For Example:
01 | message = values.Message.Changed:Connect( function () |
02 | if (values.Message.Value) then |
03 | UI.MessageFrame.Visible = true ; |
04 | if (UI.MessageFrame.Position.Y.Scale ~ = . 9 ) then |
05 | if (UI.MessageFrame.Position.Y.Scale > . 79 ) then |
07 | repeat wait() until (UI.MessageFrame.Position.Y.Scale < = . 82 or tick()-start > = . 5 ) |
10 | tweenObj(UI.MessageFrame, 1 , { Position = UDim 2. new( 0.822 , 0 , 0.9 , 0 ) } ); |
12 | if (values.Message.Value) then |
13 | UI.MessageFrame.Message.Text = values.Message.Value; |
14 | tweenObj(UI.MessageFrame, 1 , { Position = UDim 2. new( 0.822 , 0 , 0.79 , 0 ) } ); |
16 | tweenObj(UI.MessageFrame, 1 , { Position = UDim 2. new( 0.822 , 0 , 0.9 , 0 ) } ); |
18 | UI.MessageFrame.Visible = false ; |
22 | UI.MessageFrame.Message.Text = values.Message.Value; |
23 | tweenObj(UI.MessageFrame, 1 , { Position = UDim 2. new( 0.822 , 0 , 0.79 , 0 ) } ); |
25 | tweenObj(UI.MessageFrame, 1 , { Position = UDim 2. new( 0.822 , 0 , 0.9 , 0 ) } ); |
27 | UI.MessageFrame.Visible = false ; |
30 | if (UI.MessageFrame.Position.Y.Scale ~ = . 9 ) then |
31 | tweenObj(UI.MessageFrame, 1 , { Position = UDim 2. new( 0.822 , 0 , 0.9 , 0 ) } ); |
33 | UI.MessageFrame.Visible = false ; |
Segment that isn't running properly:
1 | if (UI.MessageFrame.Position.Y.Scale ~ = . 9 ) then |
At this portion, when I print the Y Position, it prints 0.89999999764121
, instead of 0.9
, as in the position property of the frame at the exact moment says {0.822, 0},{0.9, 0}
Does anyone have any related issues to this? I'm only posting this because it has always worked before, and now all of a sudden it starts with this issue. I feel as if this is a ROBLOX API issue at the moment.