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

What am I supposed to with this error?

local Alphabet ={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","r","s","t","u","v","w","x","y","z"}
local Text=game.StarterGui.ScreenGui.TextLabel
function Go()
	local Amount = math.random(1,26)
	for i,v in pairs(Alphabet) do
		if v==Alphabet[Amount] then
		local Var=Alphabet[Amount]
		Text.Text=Var
		game.Players.LocalPlayer,KeyDown:connect(function(Key)
			if Key==Var then
					return
				end
			end)
		end
	end
end
Go()

I'm trying to pick a random letter from the table and have it printed, and then, to end it, the person has to press the key.

The output says "Players.Player.Backpack.LocalScript:14: syntax error near 'end'" and when I scroll over the part that has an error, it says "Syntax error: expression must be a variable or a feild"

1 answer

✓ Accepted answer

You need to get the player's mouse for this to work. Add at the top this line.

mouse = game.Players.LocalPlayer:GetMouse()

Then add this to line 9.

mouse.KeyDown:connect(function (Key)

This should get the script to work, unless you know something I don't

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