game:GetService("UserInputService").InputBegan:Connect(function(key, gp)
if gp then return end -- stops the function if it's being processed by something else
if key.KeyCode == Enum.KeyCode.One then
script.Parent.Parent.BackgroundColor3 = Color3.fromRGB(25, 255, 62)
script.Parent.Parent.Parent.Frame2.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
script.Parent.Parent.Parent.Frame3.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
script.Parent.Parent.Parent.Frame4.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
script.Parent.Parent.Parent.Frame5.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
end
end)
The Mouse method is outdated.
No worries, my forum is being slow at the minute so my messages might appear late.
As already mentioned, it’s recommended you user UserInputService. Here’s an example of it’s use:
local UIS = game:GetService("UserInputService");
UIS.InputBegan:Connect(function(input,GP)
if input.KeyCode == Enum.KeyCode.Q then --// There are a list of KeyCodes you can find, even "One".
print("Pressed Q!");
end;
end;
UserInputService contains many useful functions which is why I recommend switching over, and that Mouse is already deprecated so no need to use it anymore.