Humanoid apparently not existing?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want the explosions to damage players

  2. What is the issue? Include screenshots / videos if possible!
    It says the player’s humanoid doesnt exist. but it does.
    image
    image

Code snippet

function module.Create(size, pos, dmg, plr, enemy, tower, allies, color, transparency, sound)
-- buncha code which doesnt matter for this discussion

	if plr == true then
		for i, target in ipairs(game.Players:GetChildren()) do
			local distance = (target.Character.HumanoidRootPart.Position - pos.Position).Magnitude
			if distance < size then
				target:FindFirstChildOfClass("Humanoid"):TakeDamage(dmg)
			end
		end
	end
end
  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I’ve tried to use :FindFirstChildOfClass but it didnt work, it used to work perfectly fine before but now it doesnt

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

-- This is an example Lua code block

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.but

youre trying to find the Humanoid inside the player not the character.

GetCharacterFromPlayer(target)LFindFirstChild(“Humanoid”):TakeDamage(dmg)

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