I've been trying to activate a remote function on a key press and it worked in studio, but when I joined the game, it didn't work.
So I tried to narrow down the possibilities of what it could be: I started off by Re-Writing the code (this time using ContextActionService instead of UserInputService), and it still didn't work, so I tried changing the players walk speed (instead of firing a remote function) and again, it worked in studio, but not in the player.
I'm not very adept at scripting (I'm just starting out ;P) so I don't know what the problem with it is. Here is my code:
local showDialog = game.ReplicatedStorage.ShowDialog -- Will be used for the remote function later isInRange = true function sendSignInfo(actionName, userInputState, inputObject) if isInRange == true and userInputState == Enum.UserInputState.Begin then print("test") game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 100 end end game.ContextActionService:BindAction("keyPress", sendSignInfo, false, Enum.KeyCode.E)
Send help if you know what the problem is!
Thanks, Kyleo.
Any scripts that deal with anything client side, like userImputService, must be in a LocalScript. Also from now on please use the a code block for your code (The little blue circle with "Lua" on it)