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

What's wrong with this Choosing Maps script? [NOT SOLVED]

Forest = game.Lighting.Forest
Trusses = game.Lighting.Trusses
Maps = {Forest, Trusses}
function ChooseMaps()
		game.Players:GetPlayers(player)
		randmap1 = math.random(1, #Maps)
		randmap2 = math.random(1, #Maps)
		while randmap1 == randmap2 do
			randmap2 = math.random(1, #Maps)
		end
		player.PlayerGui.VoteMap.Frame.Map1.Text = Maps[randmap1].Name
		player.PlayerGui.VoteMap.Frame.Map2.Text = Maps[randmap2].Name
		player.PlayerGui.VoteMap.Frame.Visible = true
	end

Okay, so, I don't think anything in this script it working. What it's supposed to do is it's gonna pick a random two maps out of the table "Maps" (yes, I'll add more), and then have the name of the maps be on the buttons on which you would vote for which one you would want most (adding that later), and then make the whole Gui visible. But NONE of this seems to be working... And nothing's showing up in the output either.

If you could figure out what's wrong with this, I would be very grateful.

1 answer

Line 6: game.Players:GetPlayers(player)

The GetPlayers function does not take any arguments. You are passing in "player" which is undefined in the script you've shown.

3 comments

0

So then what WOULD work for what I'm trying to do?

0

Okay, but what would I do to FIX it? What would I replace that with?

0

It depends on what you are trying to do. Is this a Localscript or a server script? Is this single script responsible for displaying the gui to all players or to just the local player?

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