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

What is wrong with this script? [SOLVED]

Asked by
xancor1 10
10 years ago
 local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

 local open = false

mouse.KeyDown:connect(function(key)
    if key == "q" then
        if open == false then
            open = true
                script.Parent.ShopFrame.Visible = true
        elseif open == true then
            open = false
                script.Parent.ShopFrame.Visible = false
        end
    end
end

I have tried to fix it but i cant find out what is wrong

1 answer

Log in to vote
1
Answered by 10 years ago

You forgot the end parenthesis at the end on line 4

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

local open = false

mouse.KeyDown:connect(function(key) --The open parenthesis before the "function" needs to be closed
    if key == "q" then
        if open == false then
            open = true
                script.Parent.ShopFrame.Visible = true
        elseif open == true then
            open = false
                script.Parent.ShopFrame.Visible = false
        end
    end
end) --There was no parenthesis here

Like my answer if you found it useful!

0
oh, Thanks! xancor1 10 — 10y
0
is there any way that i could make the mouse able to move while it is open (My game is locked in first person) xancor1 10 — 10y
0
I'm pretty sure you can just right click while your mouse is over the GUI, and it will unlock the mouse TurboFusion 1821 — 10y
0
If you're stuck in first person, and your mouse won't move, then press ESC TurboFusion 1821 — 10y
View all comments (2 more)
0
i cant move my mouse onto the GUI, it is at the side of the screen xancor1 10 — 10y
0
but i can just move the gui to the middle xancor1 10 — 10y
Ad

Answer this question