Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What am I supposed to with this error?

Asked by
tumadrina 179
9 years ago
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

Log in to vote
1
Answered by 9 years ago

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

Ad

Answer this question