So I want to change the color of a part when I press the N key. But whenever I press it, it doesn’t work even though I followed the entire tutorial. This is my script
StarterPlayer > StarterCharacterScripts > a Local Script:
local UIS = game:GetService(“UserInputService”)
local KeyDownEvent = game:GetService(“ReplicatedStorage”):WaitForChild(“KeyDown”)
UIS.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.N then
KeyDownEvent:FireServer()
end
end)
ServerScriptService > Script:
local KeyDownEvent = game:GetService(“ReplicatedStorage”)WaitForChild(“KeyDown”)
KeyDownEvent.OnServerEvent:Connect(function()
print "Key Pressed!"
workspace.Part.BrickColor = BrickColor.Random()
end)
and I also placed a remote event on Replicated Storage called “KeyDown”