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

UserInputService Not Firing?

Asked by 9 years ago

This is checking if the the button pressed was Enum.KeyCode.E, it works perfectly in playsolo but it doesn't work in server play?

local player = game.Players.LocalPlayer
if not player.Character then player.CharacterAdded:wait() end
local character = player.Character

game:GetService("UserInputService").InputBegan:connect(function(input)
    if input.UserInputType == Enum.UserInputType.Keyboard then
        print(input.KeyCode) --This IS printing
        if (input.KeyCode == Enum.KeyCode.E) and (player.PlayerGui.Screen["Light Interaction"].Visible == true) and (character.Humanoid.Health > 0) then
            events.InteractionKeyPressed:FireServer()
            print("Fired") --This ISNT printing
        end
    end
end)

It is this script and not the receiving end of it, character is defined above. FilteringEnabled is enabled. What can be causing this not to work only on server? I originally used KeyDown but that also worked only in PlaySolo.

2
Can you show your declaration of the player and character variables? DigitalVeer 1473 — 9y
0
Edited :) YellowoTide 1992 — 9y
0
I moved my events folder to ReplicatedFirst and it seems to be firing now, it's the other script now. Credit to TheContinentofEurope for that YellowoTide 1992 — 9y

Answer this question