Sender must be conncted to the current server

Hello. I am currently experiencing an issue with my code. What it says is “the sender must be connected to the current server”
I have tried some stuff but it didn’t seem to work, so i would appreciate any help.
The code is about 6,000 lines long so i will provide a pastebin link with the whole code.

(Error code is happening on line: 833, 184, 3438, 574)
These are only the lines of code i know that this is occuring on, unfortunately there could be a thousand more. I will have to eventually share game’s code.

(The lines you sent do not match up with the code you sent - some of them are of blank lines or just }, so it doesn’t help narrow down the issue)

sorry, this is just a ton of code that i am not able to manage, do you want the games source?

Not neccessary. Can you provide the specific line of code where one of the errors occur? This will allow us to determine the offset with the code

Sure,
Line 833:
local ret,lobby = game.ReplicatedStorage.Remotes.CreateLobby:InvokeServer(Type,Rules,Deck)

Line 3438:
local Res,ReturnedName = game.ReplicatedStorage.Remotes.RenameDeck:InvokeServer(GameUI.ClientVars.BuildSettings.SelectedDeck.Value,NewName)
Line 574 (doesn’t make any sense):
elseif #GameColors == 2 then

All I know.

alright, thank you.

Based on this line

local Res,ReturnedName = game.ReplicatedStorage.Remotes.RenameDeck:InvokeServer(GameUI.ClientVars.BuildSettings.SelectedDeck.Value,NewName)

It may be an issue on the server side. What is the code that recieves the Invoke?

function module:ReNameDeck(PlayerName,DeckName,NewName)
	
	local Data = game.ReplicatedStorage.PlayerData:FindFirstChild(PlayerName)
	if Data then
		local DeckFind = Data.Inventory.Decks:FindFirstChild(DeckName)
		if DeckFind then
			
			local FilteredResult = TextService:FilterStringAsync(NewName,23441688)
			local FilterRes = FilteredResult:GetNonChatStringForBroadcastAsync()
			
			if FilterRes ~= NewName then
				return "Filtered"
			else
				
				local SameName = Data.Inventory.Decks:FindFirstChild(NewName)
				if SameName then
					
					local DisName = NewName
					
					local NameCount = 1
					
					local Named = false
					
					repeat
						NameCount += 1
						
						DisName = NewName .. " #" .. NameCount
						
						local NextFind = Data.Inventory.Decks:FindFirstChild(DisName)
						if NextFind then
							--
						else
							Named = true
						end
						
					until Named
					
					DeckFind.Name = DisName
					return "Good",DisName
					
				else
					
					DeckFind.Name = NewName
					return "Good",NewName
					
				end
				
			end
			
		end
	end
	
	return "Bad"
	
end

I believe the issue is this line here:

local FilteredResult = TextService:FilterStringAsync(NewName,23441688)

Try replacing 23441688 with the UserId of the person who fired function

(plr.UserId)

Thank you, i will inform you how it goes.
does it have to be

local FilteredResult = TextService:FilterStringAsync(NewName,plr.UserId)

Something like that, yeah. Make sure you define plr as the Player Instance

Alright, thank you. Will reach back with the result.

It underscored “newname” with the warning Type Error: (184,56) Unknown global ‘NewName’ after putting
local FilteredResult = TextService:FilterStringAsync(NewName,Player.UserId)
(i made a local Player = game:GetService(“Players”).LocalPlayer)

(i made a local Player = game:GetService(“Players”).LocalPlayer)

Only works on local scripts.
Try using local Player = game.Players:FindFirstChild(PlayerName)


Unknown global ‘NewName’ after putting

Did you change

function module:ReNameDeck(PlayerName,DeckName,NewName)

at all?

I didn’t change any function,
and PlayerName is underscored with red again.Type Error: (15,44) Unknown global ‘PlayerName’

Can you please send the code you currently have for the server-side script? I’ll check if any of the changes you made have broken it

--X_Zscript.Parent:WaitForChild("GameHandler")script.Parent:WaitForChild(" - Pastebin.com (lobbyhandler modulescript)

I think you removed the :ReNameDeck function from it


function module:CreateLobby(PlayerName,Type,Args,Deck)
 
	if self:IsInLobby(PlayerName) or self:IsInGame(PlayerName) or self:IsSpectating(PlayerName) then return "Failed" end
 
	if Args["CodeLocked"] then
		local Code = Args["Code"]
		local FilteredResult = TextService:FilterStringAsync(NewName,Player.UserId)
		local FilterRes = FilteredResult:GetNonChatStringForBroadcastAsync()
		if FilterRes ~= Code then
			return "Filtered"
		end
	end
...
end

I believe you want this little bit to have

if Args["CodeLocked"] then
		local Code = Args["Code"]
		local FilteredResult = TextService:FilterStringAsync(Args["Code"],Player.UserId)
		local FilterRes = FilteredResult:GetNonChatStringForBroadcastAsync()
		if FilterRes ~= Code then
			return "Filtered"
		end
	end

instead

Oh. Thank you. Still, playername is underscored. I will try renaming the deck though.

Can’t load in. Argument 1 missing or nil - Server - LobbyHandler:15
Requested module experienced an error while loading - Server - Server:75

what code are you using for this function currently

function module:ReNameDeck(PlayerName,DeckName,NewName)