Remote event not firing?

  1. What do you want to achieve? I want to achieve script printing “server test” with remote event that’s being fired from a local script that prints “client test”.

  2. What is the issue? “server test” is not being printed, despite the FireServer i put in localscript.

  3. What solutions have you tried so far? As usual, I’ve looked for solutions in DevForum and Developer Hub, but it didn’t work. I also tried adding :WaitForChild(), but that didn’t work too.

Server script:

local remote = script.Parent:WaitForChild("thing")

remote.OnServerEvent:Connect(function(plr,action)
	if action == "test" then
		print("server test")
	end
end)

Local script:

local uis = game:GetService("UserInputService")
local sus = script.Parent:WaitForChild("thing")

uis.InputBegan:Connect(function(input,ae)
	if ae then
		return
	end
	if input.KeyCode == Enum.KeyCode.E then
		print("client test")
		sus:FireServer("test")
	end
end)

Output:

client test  -  Client - client:9

Would appreciate the help!

Are these two scripts in a tool?

Nope, they’re in a folder, which is located in StarterPlayerScripts.
image

remote.OnServerEvent:Connect(function(player, action)
	print(action)
	if action == "test" then
		print("server test")
	end
end)
uis.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.E then
		print("client test")
		sus:FireServer("test")
	end
end)

I think the ae is stopping it from firing because this works perfectly

I don’t think local scripts work in the starterplayer. You should put the local script to the startergui. Then put the normal script to the serverscriptservice and the remoteevent in the replicatedstorage

image
Not being printed.

image
What? Did you put the code in the correct scripts?

Looks like I’ve moved the entire folder to StarterGui and it works now. Thanks!

1 Like

Yes, and I’ve just realized that ServerScripts don’t work in StarterPlayerScripts. (I’m dumb)

1 Like