Help Fixing Error

Good morning!

I’m not sure how to fix this error, and I need some help with it.

Error:

Players.ItsBenDev.PlayerGui.ScreenGui.TextButton.LocalScript:2: attempt to index nil with 'Character'

Code:

script.Parent.MouseButton1Click:Connect(function(player)
	game.ReplicatedStorage.Essential.Clicked:FireServer(player, player.Character.Clicks)
end)

I don’t think you need to add the player, it already sends the player when firing remote events. (i believe)


game.ReplicatedStorage.Essential.Clicked:FireServer(player.Character.Clicks)

The Remote Event already sends a Player parameter on the :FireServer(), but you can use this:

local player = game.Players.LocalPlayer