Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why doesn't keyboard input work in a server?

Asked by 6 years ago

In a script I have this. The script is in a model in the Workspace.

function onKeyPress(actionName, userInputState, inputObject)
if userInputState == Enum.UserInputState.Begin and InUse == 0 and Players.LocalPlayer.PlayerScripts.Allowed.Value == 1 and script.Parent.Localizer.Value == 1 then 

print("Stuff happens here")

    end
end

game.ContextActionService:BindAction("keyPress", onKeyPress, false, Enum.KeyCode.E)

Using this works fine in Solo, but it doesn't work in a Server. I'm thinking it's because Keyboard Input is having a problem when I play on a server.

If I'm wrong please let me know. I'm trying to look for an alternative, but I'm hoping to stick to this format.

0
May you explain what you're trying to do? I'm kinda of confused but if you wanted to where if the player clicks a certain key then reply. TheePBHST 154 — 6y
0
What I'm trying to do is that when a player presses E on a model with the script in it, it runs code below it. The problem is, is that if I press E while on a Test Server, the keypress isn't received, but it works on Play Solo. BloxaBrick 2 — 6y

Answer this question