When I fire a remote event after the round ends, I get this error:

17:59:13.012 - Error while processing packet. 17:59:13.013 - Error while processing packet: Variant cast failed (packet id: 131, packet length: 90)

I've checked other forums about this and there hasnt been any solutions, I've tried switching to remote functions, using :fireallclients and removing all the extra arguments given when firing the remote event but nothing works.

Heres the scripts, although I dont think theres anything wrong with it.

Server Script:

	for _, v in pairs(players) do
		local character = v.Character
		local chosenSpawn = chosenMap.Spawns:GetChildren()[math.random(1, #chosenMap.Spawns:GetChildren())]
		v.CashEarntThisRound.Value = 0
		if character.Humanoid.Health > 0 then
			local torso = character:FindFirstChild('Torso') or character:FindFirstChild('UpperTorso')
			torso.CFrame = chosenSpawn.CFrame + Vector3.new(0, 3, 0)
			
			wait(.1)
			
			chosenSpawn:Destroy()
			table.insert(playersWhoArePlaying, v)
			
			wait()
		end
	end
	
	roundType.Value = 'FFA'

	for t = ffaDuration.Value, 1, -1 do
		roundTime.Value = t
		wait(1)
	end

	-- Give players xp and cash
	
	
	
	for i, v in pairs(playersWhoArePlaying) do
		table.remove(playersWhoArePlaying, i)
		v:LoadCharacter()
		
		v.Money.Value = v.Money.Value + v.CashEarntThisRound.Value
		v.XP.Value = v.XP.Value + v.CashEarntThisRound.Value / 50
		
		--local cashEarntThisRound = v.CashEarntThisRound.Value
		print(v.CashEarntThisRound.Value)
		--roundEnded:FireAllClients(v, v.CashEarntThisRound.Value)
		
		--wait()
		--v.CashEarntThisRound.Value = 0
	end
	
	roundEnded:FireAllClients() -- Crashes at this point

Local Script:

local replicatedStorage = game:GetService('ReplicatedStorage')

local remoteEvents = replicatedStorage:WaitForChild('RemoteEvents')
local roundEnded = remoteEvents:WaitForChild('RoundEnded')

local player = game.Players.LocalPlayer
local camera = workspace.CurrentCamera

local playerFrame = script.Parent

local cashFrame = playerFrame:WaitForChild('CashFrame')
local levelFrame = playerFrame:WaitForChild('LevelFrame')
local xpFrame = playerFrame:WaitForChild('XPFrame')

local cashLabel = cashFrame:WaitForChild('CashLabel')
local xpLabel = xpFrame:WaitForChild('XPLabel')

local cashEarntThisRound = player:WaitForChild('CashEarntThisRound')

roundEnded.OnClientEvent:connect(function()
	local cashEarntThisRound = cashEarntThisRound.Value
	cashLabel.Text = cashEarntThisRound
	xpLabel.Text = cashEarntThisRound / 50
	
	local blur = camera:FindFirstChild('Blur')
	
	if not blur then
		blur = Instance.new('BlurEffect')
		blur.Parent = camera
		
		for i = 0, 56 do
			blur.Size = i
		end
	else
		for i = 0, 56 do
			blur.Size = i
		end
	end
	
	playerFrame.Position = UDim2.new(-1, 0, 0, 0)
	
	playerFrame:TweenPosition(UDim2.new(0,0,0,0), 'Out', 'Quart', 1, true)
	
	wait(5)
	
	playerFrame:TweenPosition(UDim2.new(1,0,0,0), 'In', 'Quart', 1, true)
	
	for i = 56, 0, -1 do
		wait()
		blur.Size = i
	end
	
	playerFrame.Position = UDim2.new(-1, 0, 0, 0)
end)

3 comments

1

Can you include the code so we can replicate the error?

0

I think this is a roblox error, not an error you can fix. Never gotten this error before.

0

i've tried to reinstall the roblox client but its still doing the same thing.