Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

:InvokeServer() - Is it now broken?

Asked by 9 years ago

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?

0
I've never seen this issue before. Do you get these errors in online mode, in the F9 server log? adark 5487 — 9y
0
That's odd. Try putting the remotefunction in RepliactedStorage Shawnyg 4330 — 9y
0
I'm getting the errors in the Local log, which is even more weird. I'll try putting the functions in replicatedstorage next, thanks. gergy008 10 — 9y

Answer this question