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

My hint script doesn't work?

wait(3)
h = Instance.new("Hint", game.Workspace)
plrs = game.Players:GetPlayers()

function StartGame()
	if #game.Players:GetChildren() > 1 then
		h.Text = "Welcome to MrSmeny and MrSmenryBackup's Sword Fighting Tournament!"
	    wait(3)
	    h.Text = "The rules are simple, sword fight other people in duels and win!"
	    wait(3)
	    h.Text = "Please wait, loading map and deciding players."
        wait(3)
        h.Text = "This game is in beta, come back later."
	else
        h.Text = "There must be 2 or more players to start. Invite some friends."
	end
end

When I get 2 players in the game, my hint is empty. Why is that?

1 answer

✓ Accepted answer

From the snippet you have provided, nothing ever calls the StartGame function. Since nothing calls it, the code inside will never execute.

Continuously (every few seconds or fractions of a second) call StartGame, in, for example, a while loop.


It would also probably be wise to return success or failure. (e.g., return true in the then block and return false in the else block)

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