Bool in remote event is nil?

I have a bool that is passed in through a remote event. It is demonstrated below:

game.ReplicatedStorage.RemoteEvent:FireClient(player, true)

In my local script, I used this code:

game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function(plr, bool)
local controls = require(player:WaitForChild('PlayerScripts'):WaitForChild('PlayerModule')):GetControls()

if bool == true then
	print(bool)
	controls:Enable()
	return
end
print(bool)
controls:Disable()

end)

Apparently whenever I run this code, the “bool” parameter passed in the remote event is always nil. I don’t know why. Can someone help me?

Is bool a variable, and if it is, did you define bool before you fired the remote event?

Remove the first parameter: “plr”, OnClientEvent only has tuple arguments

2 Likes

Wow. That was fast. Thanks for the solution!

Np :sweat_smile: We all make silly mistakes, so don’t worry about it! Also do make sure to look at this for future reference: