I am trying to make pressing "Q" activate something in a server script and you cant use ContextActionService in a server script so i am having to use remote events, but for some reason it is not working, please help!
Local Script:
local repStorage = game:GetService("ReplicatedStorage")
local Q = repStorage:WaitForChild("Q")
function onKeyPress(actionName, userInputState, inputObject)
if userInputState == Enum.UserInputState.Begin then
Q:FireServer(onKeyPress)
end
end
game.ContextActionService:BindAction("keyPress", onKeyPress, false, Enum.KeyCode.Q)
Server Script:
local repStorage = game:GetService("ReplicatedStorage")
local Q = repStorage:WaitForChild("Q")
Q.OnServerEvent:connect(function(player)
print "hi"
end)

1 comment
bump