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

how can i play a tween when the Gui hits the exact size?

Asked by 3 years ago

i make a script that plays the tween when it hits the size of the GUI but it said that "expected ')' (to close ')' at column 24 got), got ','

the script

local tween = game:GetService("TweenService")

local white = script.Parent.white.Frame
local whiteb = script.Parent.white.Frame
local tickloading =         script.Parent.LoadingScreen.Background.LoadingBackground.TickLoading

local tweeninfo = TweenInfo.new(
    1,
    Enum.EasingStyle.Sine,
    Enum.EasingDirection.In,
    0,
    false,
    3
)

local goal = {BackgroundTransparency = 0}

local goal2 = {BackgroundTransparency = 1}

local create = tween:Create(white,tweeninfo,goal)

local create2 = tween:Create(white,tweeninfo,goal2)

create.Completed:Connect(function()
    wait(2)
    create2:Play()
end)

if tickloading.Size == (0.781, 0, 1, 0) then -- its here
    create:Play()
end

please help me, thank you

btw, the GUI is the bar of a loading screen so it moves to (1, 0, 1, 0) size

2 answers

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

u can have a function running all the time that will only trigger when certain requirements are met like here your bar being at (0.781, 0, 1, 0) size

safety = false
while true do
    if tickloading.Size == Vector3(0.781, 0, 1, 0) then
        if safety == false then
            safety = true
            create:Play()
            wait(5)
            safety = false
        end
    end
    end
Ad
Log in to vote
0
Answered by
Techyfied 114
3 years ago

The answer above is wrong, because he is using Vector3, which is for parts. Not GUIs. However, you could try this.

if tickloading.Size == Udim2.new(0.781, 0, 1, 0) then -- You use Udim2 to get the size. Not Vector 3 or CFrame
    create:Play()
end
0
it not work ninjanerd601 9 — 3y

Answer this question