Here’s my script:
game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent"):FireClient(ehuman)
ehuman is a humanoid
my output is: FireClient: player argument must be a Player object and I don’t understand.
Here’s my script:
game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent"):FireClient(ehuman)
ehuman is a humanoid
my output is: FireClient: player argument must be a Player object and I don’t understand.
You have to use the first argument as the Player instance, not their humanoid.
You can use the following to get the player from that humanoid
local plr = game.Players:GetPlayerFromCharacter(ehumanoid.Parent)
So it would be
local plr = game.Players:GetPlayerFromCharacter(ehumanoid.Parent)
game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent"):FireClient(plr)
(Meant to reply to the original post.)
Yes, that would work, but I am giving the reason why it isn’t working in general.
A player object is the object inside the Players folder. The Humanoid is an object inside the player’s character object. Since you are trying to fire it to a Humanoid (which is inside a player’s character) this is why you are getting this error. Instead, you must fire it to the player object.
The most easy way to do this is shown below:
local player = game.Players:GetPlayerFromCharacter(ehuman.Parent) -- Getting the player from the character (which the Humanoid is inside)
game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent"):FireClient(player)
it does the same thing what should I do
Are you sure you are referencing the ehuman
variable in the correct way? If you have it referring to the player’s humanoid the script above should work.
nevermind i forgot to add .Parent! Thanks.
Glad you got it working. No problem.
If it works for you, don’t forget to mark it as the solution so others can easily find it!