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

Random Player Chooser Then Saying The Name Script Not Working :/?

while true do
	local t = game.Workspace.ScreenGui.TextBox
	while wait (1) do
	if t.Text == "Enough Players Needed To Play!" then
	game.Workspace.NeedOneMorePlayers.Disabled = true
	game.Workspace.NeedTwoMorePlayers.Disabled = true
	game.Workspace.NeedThreeMorePlayers.Disabled = true
	game.Workspace.NeedZeroMorePlayers.Disabled = true
	t.Text = "Game Starting Soon..."
	wait (6)
	t.Text = "Intermission (17)"
	wait (1)
	t.Text = "Intermission (16)"
	wait (1)
	t.Text = "Intermission (15)"
	wait (1)
	t.Text = "Intermission (14)"
	wait (1)
	t.Text = "Intermission (13)"
	wait (1)
	t.Text = "Intermission (12)"
	wait (1)
	t.Text = "Intermission (11)"
	wait (1)
	t.Text = "Intermission (10)"
	wait (1)
	t.Text = "Intermission (9)"
	wait (1)
	t.Text = "Intermission (8)"
	wait (1)
	t.Text = "Intermission (7)"
	wait (1)
	t.Text = "Intermission (6)"
	wait (1)
	t.Text = "Intermission (5)"
	wait (1)
	t.Text = "Intermission (4)"
	wait (1)
	t.Text = "Intermission (3)"
	wait (1)
	t.Text = "Intermission (2)"
	wait (1)
	t.Text = "Intermission (1)"
	wait (1)
	t.Text = "Starting Game..."
	script.Disabled = true
	local plrs = game.Players:GetPlayers()
	local chosen = math.random(#plrs)
	local select = plrs[chosen]
	t.text = "The First Seeker Will Be",(select.Name)
	wait (6)
	local plrs = game.Players:GetPlayers()
	local chosen = math.random(#plrs)
	local select2 = plrs[chosen]
	t.text = "The Second Seeker Will Be",(select2.Name)
	wait (6)
	t.text = "The Map Chosen Is..."
end

end
end

Output says line 50 :/ It is a random player choosing script that when it chooses, it prints name1 and name2 onto the GUI message I have made.

2 comments

0

Can you add some more information about this script. e.g. type of script, background informations and the error ect.

0

This script is ridiculous. Learn how to use for loops.

1 answer

✓ Accepted answer

You're trying to do concatenation, which uses .. to combine two strings, and not a comma.

You're also using a ton of lines instead of a for loop to change the text.

The whole script is in a loop for no reason. The loop has an infinite loop inside of it, so it's never going to repeat.

You're probably going to have an issue with that script.Disabled = true line later on if you don't get rid of it.

You wrote "text" instead of "Text" a couple times.

There's another issue with your choosing random players; the second one might be the same as the first one. Using table.remove on the list of players fixes that.

You're using a ScreenGui inside of workspace. It looks like what you're trying to display this text to everyone in the game, but ScreenGuis don't display anywhere other than the PlayerGui, so you might want to use a Hint (deprecated) instead, or set up a client-side text display that receives signals from a RemoteEvent.

local t = workspace.ScreenGui.TextBox
while wait(1) do
	if t.Text == "Enough Players Needed To Play!" then
		workspace.NeedOneMorePlayers.Disabled = true
		workspace.NeedTwoMorePlayers.Disabled = true
		workspace.NeedThreeMorePlayers.Disabled = true
		workspace.NeedZeroMorePlayers.Disabled = true
		t.Text = "Game Starting Soon..."
		wait(6)
		for i = 17, 1, -1 do
			t.Text = "Intermission ("..i..")"
			wait(1)
		end
		t.Text = "Starting Game..."
		-- script.Disabled = true
		local plrs = game.Players:GetPlayers()
		local select = table.remove(plrs,math.random(#plrs))
		t.Text = "The First Seeker Will Be "..select.Name
		wait(6)
		local plrs = game.Players:GetPlayers()
		local select2 = table.remove(plrs,math.random(#plrs))
		t.Text = "The Second Seeker Will Be "..select2.Name
		wait(6)
		t.Text = "The Map Chosen Is..."
	end
end

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