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.