i need it to be in a normal script for this to work but they keydown function only seems to work in a local script
does anyone know why it only works in a local script?
--//Keystroke class
local debounce = true
script.Parent.Equipped:Connect(function()
local tool = script.Parent
local char = tool.Parent
local player = game.Players:GetPlayerFromCharacter(char)
local mouse = player:GetMouse()
local v = script:WaitForChild('Value')
mouse.KeyDown:Connect(function(key)
print (key)
-- stuff
end)
end)

4 comments
works perfectly, thank you
No problem, happy to help.
Don't forget to accept my answer if it worked.
Also, mouse.KeyDown is deprecated. You should now always use UserInputService.InputBegan.