:InvokeServer() not working for some reason

Hello!

I am currently experiencing an issue where :InvokeServer() doesn’t work at all and I have no idea why. I am calling it to check and see whether the player can teleport to the next level or not (should return true or false) but doesn’t return anything, not even nil.

LocalScript:

local RS = game:GetService('ReplicatedStorage')

local RLU = RS.Functions:FindFirstChild('RequestLevelUpdate')

script.Parent.UpSmall.MouseButton1Click:Connect(function()

print('click') -- printed

local canUp = RLU:InvokeServer('US')

print(canUp) -- not printed

end)

ServerScript:

script.Parent.Parent.Functions.RequestLevelUpdate.OnServerInvoke = function(player, arg)

print('server rec')-- not printed

return(player:WaitForChild('CurrentLevel').Value + 1 <= player:WaitForChild('leaderstats'):WaitForChild('Level').Value)

end

It looks like “ServerScript” is in… ReplicatedStorage?

Unless something changed, Scripts shouldn’t run in ReplicatedStorage. Consider moving it to ServerScriptService instead.

3 Likes