Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

RemoteFunction sending arguments?

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)

3 comments

0

Where is the error? Is it the (plr, namasde)?

0

It's both sides, for obvious reasons

0

But which line(s) are the actual errors on?

1 answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.