UserInputService and RemoteEvents

So I’m trying to make a crouching system for a W.I.P game I’m making, but the problem is when I use UserInputService to fire an event from the client to the server it won’t do anything.

I’ve tried multiple solutions and even gone through any platform/social media to find answers, yet I still got nothing even when I pressed any of the binds and checked the output.

LocalScript used to fire the event:

local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(Input, GPE)
	if Input == Enum.KeyCode.LeftControl or Input == Enum.KeyCode.RightControl or Input == Enum.KeyCode.LeftShift or Input == Enum.KeyCode.RightShift then
		game.ReplicatedStorage.Remotes.Server.Other.Character:WaitForChild("TestPrint"):FireServer()
	end
end)

ServerScript:

game.ReplicatedStorage.Remotes.Server.Other.Character.TestPrint.OnServerEvent:Connect(function(plr)
	print("Tested")
end)

First, place the print inside the condition in the local script. This will tell you if the server is being called at all.

2 Likes

if Input.KeyCode == Enum.KeyCode.LeftControl

2 Likes

Just tested it, it didn’t work but thanks for the support!

1 Like

Thank you so much! I still don’t know why I forgot something so easy and simple that could’ve been fixed with something as small as this. I guess since I just haven’t used it in a while I got confused, but thank you very much for the help!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.