This is a LocalScript I have for a leave button GUI when you teleport somewhere, you're supposed to touch a wall, get teleported and you can press the GUI to leave, but the GUI isn't appearing when I teleport. (LocalScript in StarterPlayerScripts)
game.StarterGui:WaitForChild("LeaveButtonGUI")
game.StarterGui.LeaveButtonGUI:WaitForChild("LeaveButton")
game.Workspace:WaitForChild("InsideContent")
game.Workspace.InsideContent:WaitForChild("TPWallLeft")
game.Workspace.InsideContent:WaitForChild("TPWallMiddle")
game.Workspace.InsideContent:WaitForChild("TPWallRight")
local LBGUIB = game.StarterGui.LeaveButtonGUI.LeaveButton
local TPWallLeft = game.Workspace.InsideContent.TPWallLeft
local TPWallRight = game.Workspace.InsideContent.TPWallRight
local TPWall Middle = game.Workspace.InsideContent.TPWallMiddle
local Player = game:WaitForChild("Players").LocalPlayer
Player.CharacterAdded:Connect(function(Character)
local HRP = Player.Character:WaitForChild("HumanoidRootPart")
TPWallLeft.Touched:Connect(function(LeaveButtonAppear)
LBGUIB.Visible = true
end)
end)
If I do it to the player's GUI it still doesn't do anything
game.StarterGui:WaitForChild("LeaveButtonGUI")
game.StarterGui.LeaveButtonGUI:WaitForChild("LeaveButton")
game.Workspace:WaitForChild("InsideContent")
game.Workspace.InsideContent:WaitForChild("TPWallLeft")
game.Workspace.InsideContent:WaitForChild("TPWallMiddle")
game.Workspace.InsideContent:WaitForChild("TPWallRight")
local Player = game:WaitForChild("Players").LocalPlayer
Player.PlayerGui:WaitForChild("LeaveButtonGUI")
local LocalPlayer = game:GetService("Players").LocalPlayer
local LeaveButton = LocalPlayer.PlayerGui.LeaveButtonGUI.LeaveButton
local LBGUIB = game.StarterGui.LeaveButtonGUI.LeaveButton
local TPWallLeft = game.Workspace.InsideContent.TPWallLeft
local TPWallRight = game.Workspace.InsideContent.TPWallRight
local TPWall Middle = game.Workspace.InsideContent.TPWallMiddle
Player.CharacterAdded:Connect(function(Character)
local HRP = Player.Character:WaitForChild("HumanoidRootPart")
TPWallLeft.Touched:Connect(function(LeaveButtonAppear)
LeaveButton.Visible = true
end)
end)

3 comments
use print statements for every line, and tell me where it gets to.
Maybe the character is already added before all the waitforchilds are finished. Because the character is already added, the function wont do anything.
I fixed it a while ago