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

Why is my voting script not working?

I get no errors or anything. Please help.

It's funny, when I take out the Changed event and just test it by disabling/enabling the script, everything works fine.

local h = Instance.new("Hint")

function countdown(cTime)
	h.Parent = workspace
	for i = 1,cTime do
		h.Text = tonumber(cTime - i)
	end
end

function votingVisible(bool)
	for i,v in pairs(game.Players:GetPlayers()) do
		v.PlayerGui.ScreenGui.Voting.Visible = bool
	end
end

game.Players.Changed:connect(function()
	if game.Players.NumPlayers == 1 then
		h.Parent = workspace
		h.Text = "Waiting for 2 players."
		votingVisible(false)
	elseif game.Players.NumPlayers == 2 then
		votingVisible(true)
		countdown(10)
		votingVisible(false)
	end
end)

1 answer

You should add a variable at:

game.Players.Changed:connect(function()

Like:

game.Players.Changed:connect(function(a)

Normally errors appear at Developer Console

To see it, press F9.

Also... Shouldn`t you think after 2 players on the game?

2 comments

0

"Shouldn't you think after 2 players on the game" What do you mean by this?

0

I got it to work, no thanks to anyone on this website, but I appreciate you trying.

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