I’m making a script when a player is hit, if that player is under lvl 30, the player who attacked, will get a billboardgui with text appearing on the player who he hit, but only visible to the player who attacked. So I made a fireclient with the playerobject from the player who got hit, but then it doesn’t seem like the localscript receives it for some reason. It doesn’t even print out the first line of text.
if game.Players[person].LevelsInfo.Level.Value < 30 then
print (target.Parent)
local newplr = game.Players:GetPlayerFromCharacter(target.Parent)
print (newplr) -- the player who got hit
game.ReplicatedStorage.Remotes.extras.toolowlvl:FireClient(newplr)
print ("tolowlvl sent")
return end -- only a tiny bit of the script
That’s why I used “local newplr = game.Players:GetPlayerFromCharacter(target.Parent)”, and then sent newplr. Shouldn’t that work? I don’t get any error from it.
i think at this part is that OnClientEvent dont return the player so that may error your code for some reason as you can basicaly get the player by doing game.Players.LocalPlayer
But I am trying to clone the billboardgui to the player who got hit, but only visible to the player who hit. So that “player” contains the player who got hit, not the localplayer.
The localscript is in starterplayerscripts, and yes the print target.Parent gets printed. But it only cointains the player’s character, so I used " game.Players:GetPlayerFromCharacter(target.Parent) ", which instead get’s the playersobject, and that also prints the same. But I was supposed to sent this to the player who hit, does that mean is should be FireClient(player.newplr)?
the person is actually the target.Parent.Name, so basiclly the same as newplr, but not the playerobject. But the player is the player who punched, but it didn’t show in the code I sent. But otherwise, is the first one typed the location it goes too?
Does the OnClientEvent function in the localscript also need the “player” as the first argument, or is it automaticly (newplr) the first argument there?