✓ Accepted answer
Your problems are lines 4, and 6: On line 4, lowerkey is not a valid Method, consider changing to key:lower()?, and, on line 6, you are only changing the StarterGui's GUI version, lastly, there is another two problems I am noticing; Lines 6 and the last Line; You do not need to use that much code, the more problems with two codes are; What if they do not exist? Then what? What can I do to prevent this?, this can also be fixed, however, it will require using the WaitForChild Method. Now that I have pointed out all these problems, lets fix your code;
local open = script.Parent
local plrstats = game.Players.LocalPlayer:WaitForChild("PlayerGui"):WaitForChild("plrstats")
local plrstats2= game.Players.LocalPlayer:GetMouse()
function KeyDown(key)
local key = key:lower()
if key == "e" then
plrstats.Visible = true
end
end
plrstats2.KeyDown:connect(KeyDown)
Ah, now doesn't your code looks allot better, and cleaner? :)
Hope this helped!
2 comments
It's because of line 6; You are changing the GUI from 'StarterGui', not the actual Player's 'PlayerGui', also, 'lowerkey' is not an actual Method, consider changing to 'key:lower()'?
How would I write that?