Remote function not working at all

Hello, I’m trying to check a value from the server and send either true / false back to the client.

There are no errors in the output, the only thing that prints is the 3 print statements before the InvokeServer line. Nothing prints from the server side either, and the code does not run after invoking the server.

Client Code:

local claimFunc = shopsFolder:WaitForChild("ClaimShop")

local selectedShop
local selectedShopNumber

local function selectShop()
	if selectedShop then
		print(selectedShop.Name)
		print(claimFunc.ClassName)
		print(claimFunc)
		
		local isAvailable = claimFunc:InvokeServer(selectedShop.Name)
		print(isAvailable)
		
		if isAvailable then
			camera.CameraType = Enum.CameraType.Custom
			shopSelectionUI.Visible = false
			print("Success")
		else
			warn("Shop unavailable")
		end
	end
end


selectButton.MouseButton1Down:Connect(selectShop)

Server Code:

local claimFunc = shopsFolder:WaitForChild("ClaimShop")

claimFunc.OnServerInvoke = function(player, plotName)
	warn("firing")
	local plot = plots:FindFirstChild(plotName)

	if not plot or not plot:IsA("Folder") then
		warn("Invalid plot")
		return false
	end
	
	local isTaken = plot:WaitForChild("IsTaken")
	
	if isTaken.Value == false then
		print("Not taken")
		isTaken.Value = true
		return true
	else
		print("Taken")
		return false
	end
end

Thanks.

Could you post a place file? The code you posted doesn’t seem to have any problems :thinking:

1 Like
print("before")
local claimFunc = shopsFolder:WaitForChild("ClaimShop")
print("after")

claimFunc.OnServerInvoke = function(player, plotName)
	warn("firing")

I can’t really post the place file - I’m extremely confused as there’s no errors yet the function is not firing. The code just does not run after I attempt to invoke the server.

Print’s before and after just fine.

are there any other scripts that use the remote function?

1 Like