How To Get The Humanoid of Player?

Hey Everyone, My Name Is Nehoray

I Wanted To Know How I Can Find The Humanoid of The Player

I Tried Using This Method:
(Not Working)
game.Workspace:FindFirstChild(PlayerSent):FindFirstChild("Humanoid").Health = 0

Any Other Idea?
Thanks Everyone.

2 Likes

There is many ways to get the humanoid. You can get it through a touch event, player join event etc.

Are you trying to get the player through a touch event?

I’m Trying To Get The Player From Textbox That Sent To The Server
And The Server Do It.

Did you use a remote event to send the information to the server.

1 Like

Yes I’m Creating An Admin Panel For The Community After It will Be Ready I will Release It.

Everytime the textbox changes text you can check if the text from the textbox is a player in game.Players.

Example

local TextBox = --Your textbox

TextBox.Changed:Connect(function() -- fires when anything from the textbox changes
if game.Players:FindFirstChild(Textbox.Text) then -- makes sure it is a player
--fire server
end
end)
1 Like

You should be able to get the player from the remote event.

For example,

RemoteEvent.OnServerEvent:Connect(function(Player)

local Character = Player.Character
local Humanoid = Character.Humanoid

I Mean Its Fired To The Server But Nothing Happen
I’m Firing With The Remote Things Like: "Kick",Textbox.Text

Can you show the scripts for the server?

Sure, But Its Very Long

local debounce = false

local Admin = {"nehoray1200","NEDEv5","HackItsGood"}

game.ReplicatedStorage.PlayerFind.OnServerEvent:Connect(function(player, Parameter, PlayerSent)
	print("Server")
	for i, v in pairs(Admin) do
		if player.Name == v then
			if Parameter == "Kick" then
				if game.Players:FindFirstChild(PlayerSent) then
					game.Players:FindFirstChild(PlayerSent):Kick("You Got Kicked By Admin: ".. player.Name)
				end
			elseif Parameter == "Shutdown" then
				for i, v in pairs(Admin) do
					if player.Name == v then
						for i, Player in pairs(game.Players:GetPlayers()) do
							Player:Kick("This Server Got Shutdown By: ".. player.Name)
						end
					elseif Parameter == "kill" then
						for i, k in pairs(Admin) do
							if player.Name == k then
								print("Admin")
								if game.Players:FindFirstChild(PlayerSent) then
									game.Workspace:FindFirstChild(PlayerSent):FindFirstChild("Humanoid").Health = 0
									print("Killed!")
								end
							elseif Parameter == "Jump" then
								for i, v in pairs(Admin) do
									if player.Name == v then
										if game.Workspace:FindFirstChild(PlayerSent) then
											game.Workspace:FindFirstChild(PlayerSent):FindFirstChild("Humanoid").Jump = true
										end
									end
								end
							end
						end
					end		
				end
			end
		end
	end
end)

Kick And Shutdown Is Working Correctly But Others Don’t

So what you are aiming to do is to kill the player that sent the message right?

1 Like

You didn’t add an end to your shutdown loop correctly so it’s checking if the Parameter is “kill” every time it’s kicking a player. Move an end from the end of the script to after the shutdown loop ends.

1 Like

Can You Show me What You Mean By That?

All of your if statements end at the very end of the script so it’s not working. You need to end it before the elseif

Like this, you just have to move some of the ends from the end of the script to where they’re supposed to go.

local debounce = false

local Admin = {"nehoray1200","NEDEv5","HackItsGood"}

game.ReplicatedStorage.PlayerFind.OnServerEvent:Connect(function(player, Parameter, PlayerSent)
	print("Server")
	for i, v in pairs(Admin) do
		if player.Name == v then
			if Parameter == "Kick" then
				if game.Players:FindFirstChild(PlayerSent) then
					game.Players:FindFirstChild(PlayerSent):Kick("You Got Kicked By Admin: ".. player.Name)
				end
			elseif Parameter == "Shutdown" then
				for i, v in pairs(Admin) do
					if player.Name == v then
						for i, Player in pairs(game.Players:GetPlayers()) do
							Player:Kick("This Server Got Shutdown By: ".. player.Name)
						end
					end end

			elseif Parameter == "kill" then
				for i, k in pairs(Admin) do
					if player.Name == k then
						print("Admin")
						if game.Players:FindFirstChild(PlayerSent) then
							game.Workspace:FindFirstChild(PlayerSent):FindFirstChild("Humanoid").Health = 0
							print("Killed!")
						end
					end end
			elseif Parameter == "Jump" then
				for i, v in pairs(Admin) do
					if player.Name == v then
						if game.Workspace:FindFirstChild(PlayerSent) then
							game.Workspace:FindFirstChild(PlayerSent):FindFirstChild("Humanoid").Jump = true
						end
					end
				end
			end
		end
	end		
end)
3 Likes