Tweening script not working

Before I show the script, I know the script is poorly written, but i need help with making this script work.
script:

local buttons = script.Parent.Parent.Parent
local image = buttons.Parent.Parent.ImageLabel
local mainMenuButton = buttons.Parent.Parent.BackToMainMenu
script.Parent.MouseButton1Click:Connect(function()
	buttons.Play.TextButton.LocalScript.Enabled = true
	buttons.Settings.TextButton.LocalScript.Enabled = true
	buttons.Updates.TextButton.LocalScript.Enabled = true

	buttons:TweenPosition(UDim2.new(0, 0, 2, 0), "InOut", "Quad", 1, true)
	mainMenuButton:TweenPosition(UDim2.new(0, 0, -0, 0), "InOut", "Quad", 1, true)
	buttons.Parent.TextLabel:TweenPosition(UDim2.new(-0.282, 0, 2, 0), "InOut", "Quad", 1, true)
	wait(1)
	game:GetService("StarterGui"):WaitForChild("BuildingGui"):WaitForChild("Build"):TweenPosition(UDim2.new(-0, 0, 0.091, 0), "InOut", "Quad", 1, true)
	game:GetService("StarterGui"):WaitForChild("LeaderStats"):WaitForChild("Coins"):TweenPosition(UDim2.new(0.399, 0, 0.025, 0), "InOut", "Quad", 1, true)
	game:GetService("StarterGui"):WaitForChild("ShopGui"):WaitForChild("Open"):TweenPosition(UDim2.new(0, 0, 0.202, 0), "InOut", "Quad", 1, true)
	wait(1)
	game:GetService("StarterGui"):WaitForChild("TimerGui"):WaitForChild("TheRoundWillBeStartingIn..."):TweenPosition(UDim2.new(0.875, 0,0.026, 0), "InOut", "Quad", 1, true)
	game:GetService("StarterGui"):WaitForChild("TimerGui"):WaitForChild("Timer"):TweenPosition(UDim2.new(0.875, 0,0.078, 0), "InOut", "Quad", 1, true)
	wait(1)
end)

only the top 3 tweens work, after that nothing else works. pLEASE HElp

The problem is likely because you’re calling :WaitForChild() to wait for items that don’t exist. Are you sure you want to modify StarterGui, did you mean to modify a specific player’s GUI? You can add print statements to see if :WaitForChild() ever finishes waiting, or check the Output for any warnings from it.

Also a side note, many people recommend using the new task.wait() over wait(), so you should probably too.

i just want to modify a certain button(s) in a gui(s), and yes i made sure the children exist.

1 Like

Have you used print statements? And do you really want to modify StarterGui instead of PlayerGui?

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.