I'm using :InvokeServer() in a GUI's LocalScript yet Lua is telling me that the function can only be called from the client.
Like err.. hello, it's a localscript.
Here's the output:
04:18:30.811 - InvokeServer can only be called from the client 04:18:30.811 - Script 'Players.Player1.PlayerGui.GameGUI.Main.BuyFrame.PurchaseController', Line 77 - global placeBuilding 04:18:30.811 - Script 'Players.Player1.PlayerGui.GameGUI.Main.BuyFrame.PurchaseController', Line 100 - global mouseClick 04:18:30.811 - Script 'Players.Player1.PlayerGui.GameGUI.Main.BuyFrame.PurchaseController', Line 28 04:18:30.812 - Stack End
Here's the code:
function placeBuilding(b, cost) local bPos = b.Base.Position local bName = b.Name b.Parent = models.Temp //Following line contains the error local success = game.Workspace.buildRemFunc:InvokeServer(mode, bPos, bName, cost) if success == true then placed = 1 return true //and so on
Here's the hierarchy: Click here to see image
What's going on? Am I using it wrong?