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

RemoteFunction sending arguments?

Asked by
NotSoNorm 777 Moderation Voter
8 years ago

I'm trying to send the name of a audio to a local script so it can read the timelength, This is the second day I have been trying to get this stupid crap to work.

I keep getting: bad argument #2 to '?' (string expected, got nil)

Local:

events.Senders.LocalTimeLength.OnClientInvoke = function(plr, namasde)
    for i,v in pairs (board["Main(EDIT)"][namasde]:GetChildren()) do
        if v.IsPlaying == true then
            return v.TimeLength
        end
    end
end

Server:

wait(script.Parent.Events.Senders.LocalTimeLength:InvokeClient(game.Players:GetPlayers()[math.random(1,#game.Players:GetPlayers())],  script[name].Name))

(name is not a object it's the name property of an object)

0
Where is the error? Is it the (plr, namasde)? TheDeadlyPanther 2460 — 8y
0
It's both sides, for obvious reasons NotSoNorm 777 — 8y
0
But which line(s) are the actual errors on? TheDeadlyPanther 2460 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

I believe you need to delete the "plr" argument. Localscripts don't need a "player" argument when it comes to RemoteEvent/Functions because that would just equal game.Players.LocalPlayer -- ie, only the server needs/gets a "player" argument.

Ad

Answer this question