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

Why is this remote function outputting an error?

Asked by 6 years ago

:For some reason, this basic remote function script isn't working and I'm not quite sure why. Anything wrong with my scripts?

:Function Script:

script.ClickButton.OnServerInvoke = function()
    print('Its Working!')
end

:Call Function Script:

a = 1
for i=1, 5 do
    print(a)
    a = a + 1
    wait(1)
end
script.Parent.ButtonScript.ClickButton:InvokeClient()

:Error Code:

08:50:56.079 - Argument 1 missing or nil 08:50:56.080 - Stack Begin 08:50:56.080 - Script 'Workspace.NoteTrack.Buttons.ButtonA.Script', Line 7 08:50:56.081 - Stack End

1 answer

Log in to vote
1
Answered by
theCJarmy7 1293 Moderation Voter
6 years ago

InvokeClient requires one argument, a player object. I'm not entirely sure what you're doing over there, but I believe you meant OnClientInvoke in the function script. If you are not communicating between a ServerScript and a LocalScript, you could simply use a BindableFunction

0
It suggested I use "InvokeClient", and I'm not quite sure why, I switched it to InvokeServer and it fixed the problem, thanks! EnderGamer358 79 — 6y
Ad

Answer this question