Boolean showing nil when going through remote event

hey all, im trying to pass a true/false through a remote event, but on the server side it shows as nil, can anyone help?

client side:

script.Parent.MouseButton1Click:Connect(function(player)
	print("button pressed")
	if LPlayer.ready.Value == false then
		RE.PlayerReady:FireServer(player, true)
	elseif LPlayer.ready.Value == true then
		RE.PlayerReady:FireServer(player, false)
	end
end)

server side:

RE.PlayerReady.OnServerEvent:Connect(function(player, stat)
	print("true ", stat)
	if stat == true then
		print("true")
		player.ready.Value = true
		RP.Value = RP.Value + 1

		local count = 0
		for _,v in pairs(game.Players:GetChildren()) do
			count = count + 1
		end

		if RP.Value >= count then
			RP.Value = count
		end
		RE.PlayerReady:FireAllClients(true)
	end
end)

thanks for any help !

When you use FireServer you don’t need to include the “Player” variable as it’s automatically the first variable when using OnServerEvent.

Remove the “player” and it should now show the stat.

script.Parent.MouseButton1Click:Connect(function(player)
	print("button pressed")
	if LPlayer.ready.Value == false then
		RE.PlayerReady:FireServer(true)
	elseif LPlayer.ready.Value == true then
		RE.PlayerReady:FireServer(false)
	end
end)
1 Like

completely forgot thats how it worked, thanks a bunch !

1 Like

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