Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

GUI not showing up in Online Mode?

Hello.

Earlier this week, I had made a GUI to pick a class (I've made an entire 'class' system to my game), and I have just started to make it show up under the correct conditions.

In Play Solo, it works as expected, which is- On every respawn, check if the class is one of these... ...or the player is on this team, and if they are, they get shown the GUI.

However, I've tested it in several instances of Online Mode (on a server), and it doesn't seem to be working properly. I have also tested it with the new 1 player server feature on studio, where you can see the output.

It gave me this error: Players.Player1.PlayerGui.RespawnRules:43: bad argument #1 to 'pairs' (table expected, got nil)

... however, I added a wait(0.1) to the script, and a wait(0.05) to the script that handles the Global Functions and Global Variables that were referenced by the script.

That seemed to iron out that error, or at least the output of it.

But the same problem still arises, the GUI never gets cloned under the circumstances that would be enough in Play Solo mode.

Here's the script in case you need it:

wait(0.05)
game.Players:WaitForChild(game.Players.LocalPlayer.Name)
Player = game.Players.LocalPlayer

Player.CharacterAdded:connect(function(Character)
	for a,b in pairs(_G.Monsters) do
		wait()
		if b == Player.Class.Value or Player.TeamColor == BrickColor.new("Earth green") then
			local ms = game.ServerStorage.MonsterSelect:clone()
			ms.Parent = Player.PlayerGui
			break
		end
	end
end)

_G.Monsters is a table properly referenced in another script (server-side). If you want the code snippet, here:

_G.Classes = {"Dwarf","Zombie","Nighthunter","Ogre","Thing","NA","Imp","Golem","Savage"}
_G.Monsters = {"Zombie","Nighthunter","Ogre","Thing","Imp","Golem","Savage"}

Thanks for reading; all replies are appreciated!

1 answer

Try in the properties of the gui make sure you are using the first number not the second for size. EX: (1,0) (1,0)

1 is fullscreen. The second number is size first is scale. Always use scale.

2 comments

0

That's been done. As I said, it works just as I want it to in Play Solo mode, which includes the size and being able to see it properly.

0

Sorry for not being able to help then.

This discussion is preserved as it was. New answers, comments, and votes are closed.