Issue with printing values sent from Remote Event

Hello, I have an issue with remote events. I am trying to print the value sent from the Remote Event (from a local script), but the server doesn’t print the value. I tried finding the same example on other topics, but it wasn’t concluding.

From a local script.

local x = 55
game:GetService("ReplicatedStorage").Folder:WaitForChild("RemoteEvent"):FireServer(x)

From a Server Script.

game:GetService("ReplicatedStorage").Folder:WaitForChild("RemoteEvent").OnServerEvent:Connect(function(player, number)
print(number)
end)

-- And the printing doesn't work.

Thank you in advance.

I tested it out, and it worked.

I suggest you organizing your code.

--local script
local replicated = game:GetService("ReplicatedStorage")
local remote = replicated:WaitForChild("Remotes"):WaitForChild("Remote")

make a seperate variable for remote event
and
RS=game:GetService(“ReplicatedStorage”)
remoteEvent=RS:FindFirstChild(“RemoteEvent”) or RS:WaitForChild(“RemoteEvent”)
remoteEvent:FireServer(x)

It’s only a test, except that I organize my scripts.

Pretty sure the issue is that you’re firing it immediately after it’s instance loads in, so the server may have not loaded the RemoteEvent by the time you’ve fired it from the client.

Where did you put your local script tho?

I added a wait(1) before the client fires it so I don’t think it’s about the server not receiving the firing.

That’s just one second. Change that to 8 and then see if it works.

I also tested it with 10 seconds. Tho, I’ve put the local script and the server script in the Workspace, and I think this is the issue. With your advice, where should I put them?

Try a common setup of the script in ServerScriptService and the localscript in the StarterPlayerScripts

:upside_down_face:

charLimit