Greetings developers!
If you have played Meep City recently, you noticed that when a player goes into avatar editor mode, a GUI will pop over his head. I want to do the same thing with my game.
local billboardgui = game:GetService("ServerStorage"):WaitForChild("BillboardGui")
local HomeButton = game.Players.LocalPlayer:WaitForChild("PlayerGui"):WaitForChild("Menu"):WaitForChild("BackFrame"):WaitForChild("Home")
local ClubButton = game.Workspace:WaitForChild("MainMenu"):WaitForChild("BillboardMenu"):WaitForChild("StartButton"):WaitForChild("SurfaceGui"):WaitForChild("TextButton")
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
print("Gui Added")
local clonedgui = billboardgui:Clone()
clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head
clonedgui.Enabled = false
HomeButton.MouseButton1Click:Connect(function()
print("Afk")
clonedgui.Enabled = true
end)
ClubButton.MouseButton1Click:Connect(function()
clonedgui.Enabled = false
end)
end)
end)
I get an error which says that i am trying to index nil with WaitForChild while defining HomeButton
Placement of each button and the GUI :
-
HomeButton
-
ClubButton
-
Overhead GUI
Thank you so much for helping!