Why is my 3d text button invisible?

So I’m trying to make a 3d main menu, but I’ve realized that TextButtons on SurfaceGUIs on Parts don’t work. So, I moved the SurfaceGUI to StarterGUI and Adornee’d it to the Part I want it to work on. But for some reason, when I press play, the TextButton becomes invisible, even though I can see it in the normal studio build mode.

local button = script.Parent
button.MouseButton1Click:Connect(function()
	print("working")
end)

This is all the script I have, I have no clue what’s wrong.

1 Like

Nevermind. I realized I’ve turned off CharacterAutoLoads, so I can’t click the button without a character. Annoying, because I wanted the button to load the character.

You can manually insert the GUI into PlayerGui using a server script to get around this problem.

This happens because Roblox doesn’t insert UIs from StarterGui until your character loads.

I see, how would I be able to do this?

local ui = UI LOCATION HERE
local players = game:GetService("Players")

local onPlayer = function(player)
   ui:Clone().Parent = player.PlayerGui
end

players.PlayerAdded:Connect(onPlayer)
for _,player in pairs(players:GetPlayers()) do
   task.spawn(onPlayer,player)
end

Try something like this, it’ll run the onPlayer whenever a player is added to the game and then it’ll put the UI in their PlayerGui.

Where would I put this script?

Place it in ServerScriptService as a script.

For the easiest way, move your UI to inside of the script, name it UI and make line 1 of the script:

local ui = script:WaitForChild("UI")

It’s working! Thanks! Now all I have to do is make the camera go back to the character when I click my Play button. Know how? If not that’s totally cool, thanks!

1 Like

What are you doing when the button is pressed?

The button is a play button, and when it’s pressed, the character loads, and the camera goes to the normal character camera. When you load in, the camera is set on a main menu area.

Does pressing the button load the character yet? That’s what I’m confused on.

I’m working on that, but I can’t really figure it out. I’m trying to use a RemoteEvent to tell the game to load the character but I don’t really get how to do it.

1 Like

You’re on the right path! What do you have so far as your code for the remote?

Also, will they need to spawn in more than once?

They won’t need to spawn more than once. So far I have this script:

local button = script.Parent
button.MouseButton1Click:Connect(function()
	print("working")
	game.ReplicatedStorage.loadCharacter:FireServer()
end)

That is the localscript that plays when you click the Play button. I have a RemoteEvent in ReplicatedStorage.

In ServerScriptService I have this Script:

game.ReplicatedStorage.loadCharacter:Connect(function(Player)
	Player:LoadCharacter()

end)

This looks good so far, just one note but I can discuss that later. Is it not working?

No, it isn’t working. I don’t understand why. I can tell because when the character loads, a small tutorial of GUIs fade in and out, but they don’t.

Any errors in the output? Is it a LocalScript inside of the button?

Wait, there is an error.
"Connect is not a valid member of RemoteEvent “ReplicatedStorage.loadCharacter”

Oh, I’m blind.

remote.OnServerEvent:Connect

instead of

remote:Connect

That’s because Connect doesn’t exist directly on the event, as there’s nothing for it to connect to.

Thank you! That worked! You’ve been so helpful. My final task is to set the camera back to the normal character camera. If you don’t want to help anymore that’s totally fine!

1 Like