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

How do I fix this error that I get when I test the game?

Asked by 4 years ago

When I test the game, this appears in the output:

15:25:56.297 - Players.MinecraftButterfly87.PlayerGui.LocalScript:14: Expected ')' (to close '(' at line 8), got <eof>

This is what's in the scipt:

local debounce = false

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

if debounce == false then
   debounce = true --Now your code will not run, because debounce is not false.
    mouse.KeyDown:connect(function(key)
        if key == "e" then
          print("Pressed e")
    wait(5)
    debounce = false --Now your code will run again.
    end)
end

2 answers

Log in to vote
0
Answered by 4 years ago

I believe you missed an end, use the script i fixed for you

Use this:

local debounce = false

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

if debounce == false then
   debounce = true --Now your code will not run, because debounce is not false.

    mouse.KeyDown:connect(function(key)
        if key == "e" then
          print("Pressed e")
        wait(5)
        debounce = false --Now your code will run again.
    end
    end)
end
0
Well, it works, but the debounce doesn't, ha. MinecraftButterfly87 10 — 4y
0
If it fixes your problem then mark this as the solution, if your script doesnt work then you can make a new question for fixing it if you dont know how to ChrisTheRobloxPlayYT 256 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

To start, insert a LocalScript in StarterGui.

Inside of the LocalScript type this:

local keydown = false

game:GetService("UserInputService").InputBegan:Connect(function(key, GPE)
    keydown = true
    if key.KeyCode == Enum.KeyCode.E and not GPE then
        print("Pressed e")
    end
end)

When you press e, the game will print "Pressed e".

If this did work, please mark this as the solution. If you were looking for something else, please comment on this answer what you specifically want and I'll try to make it :)) .

Answer this question