RemoteEvent returns nil regardless of what's put into it

Here it prints nil, in the server script.

game.ReplicatedStorage.getFile.OnServerEvent:Connect(function(player, fileName, code)
	local fileContent = getPersonalFile(player, fileName)
	print(code)
	game.ReplicatedStorage.getFile:FireClient(player, fileName, fileContent, code)
end)

Here’s the local script that sends it:

local function on2Click()
	game.ReplicatedStorage.removeFile:FireServer(script.Parent.Name, "Code1")
end
button.MouseButton1Click:Connect(onClick)
button.MouseButton2Click:Connect(on2Click)
game.ReplicatedStorage.getFile.OnClientEvent:Connect(function(filename, content, codeb)
	print("Test1")
	print(codeb)
	if codeb == "Code1" then
		print("test2")
		script.Parent.Parent.Parent.WordProcessor.Bar.Title.Text = tostring(filename)
		script.Parent.Parent.Parent.WordProcessor.TextPage.Text = tostring(content)
		print("test3")
	end
end)

It still returns nil when I try to print the code in the server script and the local script.

I’m not sure what’s going on.

The goal here is to return the code so that it knows that it was referring to that specific localscript only instead of calling all localscripts that use the same event.

I am the singular most stupid person alive.

I placed it in the WRONG one, it was only meant for the single click one.

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