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.
make a seperate variable for remote event
and
RS=game:GetService(“ReplicatedStorage”)
remoteEvent=RS:FindFirstChild(“RemoteEvent”) or RS:WaitForChild(“RemoteEvent”)
remoteEvent:FireServer(x)
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.
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?