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.

3 comments

2

Can you show your declaration of the player and character variables?

0

Edited :)

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