Can't detect KeyCode in tool equipped

Does anyone know what’s wrong in my code? :frowning:

script.Parent.Equipped:Connect(function(Key)
	if Key.KeyCode == Enum.KeyCode.N then
		print("done")
	end
end)
4 Likes

Maybe use UserInputService?

local UIS = game:GetService("UserInputService")
1 Like

Thanks you guys! :smiley: :smiley:

do you guys know what’s wrong here?

frame.BackgroundColor3 = BrickColor.new(255, 255, 255)

so probably

frame.BackgroundColor3 = color3.FromRGB(255, 255, 255)

got an error here :scream:

What is line 34?

blah blah blah (filler XD)

			frame.BackgroundColor3 = Color3.FromRGB(255, 255, 255)

this jajaja

is this a player gui? Because that may be the reason but im not sure yet

it’s a tool localscript

image

oh sorry i got confused with what i was saying hm

Change this:

local frame = game.StarterGui

For this:

 local frame = game:GetService("Players").LocalPlayer.PlayerGui

LocalScripts cannot access StarterGui.

1 Like

is it good? :scream:

-- Declared
local frame = game:GetService("Players").LocalPlayer.PlayerGui
frame.Screen:FindFirstChild("NightConfig").BackgroundColor3 = Color3.FromRGB(255, 255, 255)

image

1 Like

looks pretty good to me does it work now?

it doesnt work :C
image

frame.Screen:FindFirstChild("NightConfig").BackgroundColor3 = Color3.FromRGB(255, 255, 255)

I am incredibly impressed that you did the search by yourself, found a working solution and then LINKED to it instead of copy pasting! WoW :open_mouth:

1 Like

?? just asking for help, dont be silly

Lol, it’s for a letter XD
Replace this:

FromRGB

For this:

fromRGB

No I didn’t mean to be rude. I assumed other people will just copy paste the answer instead of linking to the original answer.

2 Likes