Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

system says "TakeDamage is not a valid member of model"?

I'm making a punch script and when the part welded to your arm touches another humanoid it says take damage is not a valid member of model

x.Touched:connect(function(hit)
	print('touched')
	if hit.Parent:FindFirstChild("Humanoid") and hit.Parent.Name ~= plr.Name then
		hit.Parent:TakeDamage(5)
	end
end)

the system prints touched and I am testing the damage on a dummy

2 comments

0

is this a shorten version of your script? if yes then I think that the problem lies with one of your variable that has "takedamage" in it.

0

It should be Humanoid:TakeDamage(). You were just referring to the player Character not the humanoid.

1 answer

:TakeDamage() is a function of the Humanoid, not the character model. It should actually be hit.Parent.Humanoid:TakeDamage(5)

This discussion is preserved as it was. New answers, comments, and votes are closed.