I have this Local Script that has an OnClientInvoke event and that also uses the same Remote Function to Invoke the server, however when I invoke the server it gives me an error saying 'attempt to call table value'.

Here is the script, I've edited out bulk

local TeleportService = game:GetService("TeleportService")
local player = game.Players.LocalPlayer

local teleportData = TeleportService:GetLocalPlayerTeleportData()

local playerGui = player:WaitForChild("PlayerGui")
local countDown = playerGui:WaitForChild("CountDown")
local members = countDown.Members
local storage = game.ReplicatedStorage:WaitForChild("Storage")

local Remotes = game.ReplicatedStorage:WaitForChild("Remotes")
local getCharacterAppearance = Remotes:WaitForChild("getCharacterAppearance")
local joinedPlayers = Remotes:WaitForChild("joinedPlayers")

local party = {}

local function joinedPlr(plr)
	party[plr].LoadFrame.BackgroundTransparency = 1
	party[plr].LoadFrame.LoadText.TextColor = Color3.fromRGB(12, 255, 28)
	party[plr].LoadFrame.LoadText.Text = "Ready"
	
	return true
end

joinedPlayers.OnClientInvoke = joinedPlr

if teleportData then
	local alreadyJoined = joinedPlayers:InvokeServer() -- ERROR HERE
	
	for i,v in pairs(alreadyJoined) do
		if party[v] then
			party[v].LoadFrame.BackgroundTransparency = 1
			party[v].LoadFrame.LoadText.TextColor = Color3.fromRGB(12, 255, 28)
			party[v].LoadFrame.LoadText.Text = "Ready"
		end
	end
end

2 comments

1

Please post the server code. Also OnClientInvoke the function you assign it doesn’t get a default player.

0

The plr argument in the OnClientInvoke is not a default player argument, rather a name, and the issue was needing to add a WaitForChild for one of the remotes as for some reason it was not registering.