Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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

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

1 comment

0

it not work

This discussion is preserved as it was. New answers, comments, and votes are closed.