Phone gui Script not working but i get no errors

Hello
I am making this script which makes different “app” buttons open a screen on a phone.

I’ve tried working with premade functions but that didn’t seem too much help either.

local player = game.Players.LocalPlayer
local PlayerGui = player:WaitForChild("PlayerGui")

local phonemain = PlayerGui:WaitForChild("Phone")
local phone = phonemain.MainFrame

local apps = game.ServerStorage:WaitForChild("Apps")
local children = apps:GetChildren()

local button = phonemain.MainFrame.Button

local calendar = apps:WaitForChild("CalendarApp")
local car = apps:WaitForChild("CarApp")
local contacts = apps:WaitForChild("ContactsApp")
local home = apps:WaitForChild("HomeApp")
local info = apps:WaitForChild("InfoApp")
local internet = apps:WaitForChild("InternetApp")
local maps = apps:WaitForChild("MapsApp")
local message = apps:WaitForChild("MessageApp")
local sett = apps:WaitForChild("SettingsApp")



local function undoappcall()
	children.Parent = game.ServerStorage.Apps
end

phone.Screen.App1.chat.MouseButton1Click:Connect(function()
	message.Parent = phone
end)

phone.Screen.App2.call.MouseButton1Click:Connect(function()
	contacts.Parent = phone
end)

phone.Screen.App3.account_box.MouseButton1Click:Connect(function()
	info.Parent = phone
end)

phone.Screen.App4.insert_invitation.MouseButton1Click:Connect(function()
	calendar.Parent = phone
end)

phone.Screen.App5.pin_drop.MouseButton1Click:Connect(function()
	maps.Parent = phone
end)

phone.Screen.App6.public.MouseButton1Click:Connect(function()
	internet.Parent = phone
end)

phone.Screen.App7.settings.MouseButton1Click:Connect(function()
	sett.Parent = phone
end)

phone.Screen.App8.time_to_leave.MouseButton1Click:Connect(function()
	car.Parent = phone
end)

phone.Screen.App9.weekend.MouseButton1Click:Connect(function()
	home.Parent = phone
end)

sorry if its a mess I’m a beginner scripter

the children after the “App 1-9” are names of image buttons.

I’m not sure if this is the issue or not, but anything you want to draw on top of something else needs a higher ZIndex.

image

1 is drawn before 2, so 2 is displayed. Both at 1 leads to unpredictable results.

The other thing I see is you don’t ever clear the screen. That could be somewhere else.

Also, if you can’t get this to work, I use transparency to change menus. Everything already parented. Just something you can try. Focus on getting one button to work, then the rest should follow.

thanks it worked. if i would want to make every app visible = false at once do I use :GetChilren?

That should work, then use a for/pairs loop to get them all.