Tables when using Remote Events

I am currently experimenting with using tables in my remote events as a suppose to individually listing each individual thing. But when I try to use as asset of my table in my server serverscript it just comes back as an unknown global so I am unsure how I am suppose to use stuff from my tables in my server scripts. Here are my scripts for example.

Local Script:

function OnSisterNeeded()
	if SistersNeeded then
		local Table = {
			CoWorkers,
			SistersNeeded
		}
		RemoteEvents.ServerReturnFunction:InvokeServer("NeedSisters", Table)
	end
end

ServerScript

RemoteEvents.ServerReturnFunction.OnServerInvoke = function(Player, Event, Table)
	local WebhookURL = "NOTHING FOR PRIVACY"
	local Role = Player:GetRoleInGroup(ServerGroupID)
	local Rank = Player:GetRankInGroup(ServerGroupID)
	
	local UserID = Player.UserId
	local Username = Player.Name
	if Event == "NeedSisters" then
		if Rank < MinimumRankToAccessStaffTools then return end
		local NeedSisterEmbedInformation = {
			["content"] = "@here This Server Needs Sisters Urgently. (If you don't want to be pinged, mute the channel.)",
			["embeds"] = {{
				["title"] = "**Click here to view their profile**",
				["color"] = tonumber(0x2f3136),
				["url"] = "https://www.roblox.com/users/" .. Player.UserId .. "/profile",
				["fields"] = {{["name"] = "Server Information:",
					["value"] = "**Amount of Players:** "..#Players:GetPlayers().."\n**Amount of Staff:** "..CoWorkers
				}}
			}}
		}
		local FinalData = HttpService:JSONEncode(NeedSisterEmbedInformation)
		HttpService:PostAsync(WebhookURL, FinalData)
	end 
end

To access the elements in the Table variable in your server script, you can simply use the indexing operator [] . For example, to access the CoWorkers variable in the table, you can use Table[1] . To access the SistersNeeded variable in the table, you can use Table[2] .

OMG THATS SO SIMPLE. Thank you so much; I’ll try it now

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.