Why will my RemoteFunction not work?

Hello,

So I want to use RemoteFunctions more but I keep having an issue in that I never can seem to find a way to make mine run. :frowning: I have no clue what I am going wrong and it makes no sense to me. I would say I am a decent programmer on Roblox but this is really making me confused on why it keeps not working.

Server Code:

Events.CheckCount.OnServerInvoke = function(player)
	print("hopefully this runs?")
	if CorrectCount >= RequiredCorrect then
		-- Write the embed send stuff here
		print("user has the amount needed")
		return true
	else
		-- Write the embed send stuff here
		print("user does not have amount needed.")
		return false
	end
end

Local Code:

	local Check = Events.CheckCount:InvokeServer()
	print("runs")
	if Check == true then
		print("run true stuff here")
	else
		print("run not true stuff here")
	end
1 Like

Whats the output when you run this?
Seems it should work without issues, if the remote is in the right folder.
At least you should get “hopefully this runs?” print

1 Like

Nothing runs at all in regards to the RemoteFunction part of my code which is what confuses me.

Nope that does not run at all.

That is what I expect, it to run without issues but I don’t understand why it is not. And yea I am sure it is in the correct folder - I have never been able to get remote functions to work for some reason.

Thats so weird…
Just for debugging, try this:

  • Place a RemoteFunction in ReplicatedStorage name it REM
  • Put this in a Script in ServerScriptService:
game.ReplicatedStorage:WaitForChild("REM").OnServerInvoke = function()
	print("Run!")
	return true
end
  • Put this in a LocalScript in PlayerScripts:
    print(game.ReplicatedStorage:WaitForChild("REM"):InvokeServer())

Found my issue. I accidentally put the script in storage.

Thanks @Dev_Peashie for trying to help me.

1 Like

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