:FireClient() not working!

I want to make it so my FireClient() works properly but for some reason, it says, “FireClient: player argument must be a Player object” even though I think I tried player object.

Here is some footage

Screenshot of Output

Script

script.Parent.Touched:Connect(function(player)
	game.ReplicatedStorage.RemoteEvent:FireClient(game.Players.LocalPlayer)
end)
-- My script

What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I replaced arguments with “player”, “player.Parent”, (hit.Parent) and “game.Players.LocalPlayer”
but nothing works, I looked on the Developer Forum as well but to no avail.

output:

FireClient: player argument must be a Player object

Any solutions? Please reply below, thank you, feedback would be good

You can not access ‘game.Players.LocalPlayer’ in a Regular Script.

1 Like

The first argument of Touched is the part that touched it. Try this:

script.Parent.Touched:Connect(function(hit)
      local player = game.Players:GetPlayerFromCharacter(hit.Parent)
      if not player then return end
      game.ReplicatedStorage.RemoteEvent:FireClient(player)
end)
4 Likes

Okay thanks, ill give it a try! :happy2:
Thank you so much, it works :shock: i never knew “:GetPlayerFromCharacter()”, thank you! I give a big hug, okay thanks!

2 Likes