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

Number Value Function not firing?

Asked by 2 years ago

Hello. I want to make a sliding GUI that is moved with Tweens. The function to make the Tween play is supposed to change upon a Number Value being changed. That Value is inside the workspace and is controlling multiple things. The function works perfectly fine in other models inside the workspace. However with this GUI in the StarterGui, it does not do anything. There are no errors inside the Output either. The function simply does not fire. I've tried putting the entire code into a Local Script and into a regular script. That does not change anything either.

The script in question is the following:

local TweenService = game:GetService("TweenService")                            

local door = script.Parent.Frame
local UI1 = script.Parent.Frame.ImageLabel.I1
local UI2 = script.Parent.Frame.ImageLabel.I2

local Closed = game.Workspace.Y



local tweenInfo = TweenInfo.new(
    1,
    Enum.EasingStyle.Sine,
    Enum.EasingDirection.InOut,
    0,
    false,
    0
)

local ClosedGoal = UDim2.new(7.2, 0,-0.176, 0)

local OpenGoal = UDim2.new(1.07, -100,0.764, -100)


local TweenOpen = TweenService:Create(door, tweenInfo, {Position = OpenGoal})
local TweenClosed = TweenService:Create(door, tweenInfo, {Position = ClosedGoal})
local TweenI1Closed = TweenService:Create(UI1, tweenInfo, {ImageTransparency = 1})
local TweenI1Open = TweenService:Create(UI1, tweenInfo, {ImageTransparency = 0}) 
local TweenI2Closed = TweenService:Create(UI2, tweenInfo, {ImageTransparency = 1}) 
local TweenI2Open = TweenService:Create(UI2, tweenInfo, {ImageTransparency = 0})

Closed.Value = 0

Closed:GetPropertyChangedSignal("Value"):Connect(function()
    if Closed == 1 then
        wait(1)
        TweenOpen:Play()
        wait(1.5)
        TweenI2Open:Play()
        wait(6)
        TweenI2Closed:Play()
        wait(1)
        TweenClosed:Play()


    elseif Closed == 2 then
        wait(1)
        TweenOpen:Play()
        wait(1.5)
        TweenI1Open:Play()
        wait(6)
        TweenI1Open:Play()
        wait(1)
        TweenClosed:Play()

    elseif Closed == 3 then
        print ("I DO NOTHING!")
    end
end)

Help would be greatly apprecieated.

Answer this question