Problem with firing client

So I ran into a problem while testing my landmine. I need to fire client to the player. But it doesn’t look like I can fire it to the player. I first sent the event to the player. It gave me an error. Then I tried modifying the code so that it was player: Player. But it gave me an error.

Here is my script (server script)

Explosion.Hit:Connect(function(player)
if player.Parent:FindFirstChildOfClass(“Humanoid”) then
player.Parent.Humanoid.Health = player.Parent.Humanoid.Health - 3
–fires client
remote:FireClient() --how can I fire to player
end
end)

Actually, you can look at the roblox documentation for this (Remote Events and Callbacks | Documentation - Roblox Creator Hub)

This is simply as follows;
event:FireClient(player, OtherArgs)

2 Likes
Explosion.Hit:Connect(function(hitPart)
  if hitPart.Parent:FindFirstChildOfClass("Humanoid") then
    local hitCharacter = hitPart.Parent
    local hitHumanoid = hitCharacter:FindFirstChildOfClass("Humanoid")
    local hitPlayer = game:GetService("Players"):GetPlayerFromCharacter(hitCharacter)
    hitHumanoid.Health -= 3 -- did you know you could do this?
    remote:FireClient(hitPlayer, ) -- after this comma, put whatever data u need to send
  end
end)

and pls add indentation for your code and try to label variables differently (just naming the output player is wrong because it outputs a BasePart and not a Player)

1 Like

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