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

OnServerEvent is not recieving tuple arguments, whats wrong?

I've looked on here at different scenarios, but my server script still isn't receiving tuple arguments that i have sent from my local script. Please help

in localscript: (event is the RemoteEvent that is being fired)

event:FireServer("Fire", endpos, hit)

in server script i have this:

event.OnServerEvent:connect(function(Client,...)
	local tuple = {...}
	if tuple[1] == "Fire" then
		local endpos = tuple[2]
		local hit = tuple[3]
				--more code
	end
end)

first post if you need to see more lmk

1 comment

0

I think OnServerEvent's first argument is always the player from the client that triggered the request

2 answers

✓ Accepted answer

if you are receiving the tuple arguments in a table, you have to send them in a table. Try this:

(localscript)

local tuple = {"Fire", endpos, hit}
event:FireServer(tuple)

(script)

event.OnServerEvent:connect(function(Client, tuple) -- you don't need to rewrite a table cuz it's already in a table form.
	if tuple[1] == "Fire" then
	        local endpos = tuple[2]
	        local hit = tuple[3]
		-- more code
	end
end)

6 comments

0

hey if that don't work can you post the output or any errors that appear

0

Tried This, still not recieving info

0

OH

0

sorry caps

0

wait nvm its working it was a problem with what was below it! Thanks!

0

oh ok no problem!

Oop. Try this: LocalScript

event:FireServer("Fire", endpos, hit)

Script

event.OnServerEvent:Connect(function(thing1,thing2,thing3)
	print("Fired")
	if thing1 == "Fire" then
		local endpos = thing2
		local hit = thing3
	end
end

If this does not work, try to add brackets such as these {} to store the data event:FireServer({"Fire",endpos,hit})

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