Issue with RemoteEvent

Hello all, I’ve encountered an issue that I’ve spent an hour trying to find and resolve. It appears either A, the given remote event isn’t firing to the server or B, The server isn’t recognizing the remote event firing. Option A seems highly unlikely since I have extensively tested every parameter and if statement to make sure everything is correct. The Local Script functions as designed. So, either the server script appears to not pickup on the fired event or the event isn’t being fired. No errors are being thrown. The Server script is in ServerScript Service, the Remote event is in a folder thats in ReplicatedStorage, The Local script is within a GUI in StarterGui. None of the prints within the server script will fire.

Problem Solved

Thank you for reviewing!

1 Like

Try this:

ATMEvent.OnServerEvent:Connect(relay)

Maybe this is the problem.
If it didn’t work then try removing the local on local function.

1 Like

Thank you for informing me of my rather obvious typo… Unfortunately neither of these options worked.

1 Like

Does it print “Relayed” after the terminalNum ?

It does not unfortunately. None of the Relay() prints execute.

I don’t know if this is gonna work but try changing RS.Shared.Remotes.ATMEvent to RS:WaitForChild("Shared"):FindFirstChild("Remotes"):FindFirstChild("ATMEvent")
on both scripts.

That does not appear to make a difference, It would have thrown an error in the first place if it couldn’t define the variable.

1 Like

Hey, you did it incorrect in the server script. You should describe there your variables. That’s how the script would look like:

local proxService = game:GetService("ProximityPromptService")
local proximity = script.Parent.Proximity.Attachment.ProximityPrompt
local RS = game:GetService("ReplicatedStorage")
local CurrencyName = RS.Shared.Settings.CurrencyName.Value
local CurrencyName2 = RS.Shared.Settings.CurrencyName2.Value
local ATMEvent = RS.Shared.Remotes.ATMEvent


ATMEvent.OnServerEvent:Connect(function(player, terminalMode, terminalNum)
	print("Relayed")
	print(player.Name)
	print(terminalMode)
	print(terminalAmount)
	-- Continue script here
end)

And here explain why this:
When you have fired server with these variables, you need to tell the server which variables it should read. Remote Event doesn’t have constant variables, you give them to it. :slight_smile:

Thank you for that suggestion, I had already tried that though. Variables will still pass whether the function is separate or connected. (From what ive tested).

print(terminalNum)
ATMEvent:FireServer(terminalMode, terminalNum)

Is this print command executing?

Yes, It is. Everything on the client side works as designed.

local ATMEvent = RS:WaitForChild("Shared"):WaitForChild("Remotes"):WaitForChild("ATMEvent")

Try replacing the declaration for “ATMEvent” in the local script to this.

How about try adding a print under the FireServer to be fully sure that the client has no problem?

ATMEvent:FireServer(terminalMode, terminalNum)
print("fired to server")

Thank you for the input, I’ve already tried that. Like I stated above, If the variable couldn’t be defined it would throw an error.

The print does execute, Indicating that the event is being fired. ( In theory )

How about try adding a print before connecting the OnServerEvent?

print("onserverevent")
ATMEvent.OnServerEvent:Connect(relay)

Thank you for this, Whenever I went to go try this I realized what was causing the problems, It was 2 variables that I no longer needed that stuck the script. I also recognized a few more mistakes I made. Turns out scripting at 1 AM is not a good idea.

1 Like