SOLVED RemoteFunction call not being picked up by Server

Basically, I’ve made a settings gui where I can toggle a certain setting on and off.

When the client calls the “changeSetting” function, it prints to the output and invokes the remoteFunction,
but the server is not picking up the call.

Things to note:
1- There is only 1 remoteFunction named “SetSetting”
2- It is indeed a remoteFunction
3- The server already picks up that it exists.
4- The server is not picking up the invokeServer call
5- No errors are outputted

–ClientScript

local function changeSetting(str)
	print(str) --Prints to the output
	local success = game.ReplicatedStorage.Remotes.Functions.SetSetting:InvokeServer(str)
end
	
local function init()
	changeSetting("Music")
end

--Script
init()

–Server

print(game.ReplicatedStorage.Remotes.Functions.SetSetting.ClassName)
--Outputs "RemoteFunction", so I know it exists

game.ReplicatedStorage.Remotes.Functions.SetSetting.OnServerInvoke = function(player, str)
	print(player, str) -- Not printing anything at all


	--local settingsStore = datastore2("Settings", player)
	--local mySettings = settingsStore:Get()

	--if mySettings[str] == nil then return end

	--if mySettings ~= "AutoDelete" and typeof(mySettings[str]) == "boolean" then
	--	mySettings[str] = not mySettings[str]
	--end

	--settingsStore:Set(mySettings)
end

Try only printing str to see if that spits out the string you were hoping for.

1 Like

You are creating a variable success and not firing the event
replace this code for the clint script

Code
local function changeSetting(str)
	print(str) --Prints to the output
    game.ReplicatedStorage.Remotes.Functions.SetSetting:InvokeServer(str)
end
	
local function init()
	changeSetting("Music")
end

--Script
init()
1 Like

It does print out the value wanted, yes. The server isn’t picking up anything though.

Whether or not it is in a variable is not the issue. My script uses a RemoteFunction and I have it inside a variable to invoke the server and it runs perfectly fine.

1 Like

So…Originally it wasn’t printing anything and now it is printing the string?

1 Like

Nevermind. Appreciate the assistance. Turns out I connected 2 different listeners via the server :man_facepalming:

It ended up overwriting the one I was working on. :sob:

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