On line 6, it says "Noob". How do you make it so that as long as the first letters are "Noob", if the noob is named like "Noob 1" or "Noob 2", but more importantly a complicated name after "Noob", it still damages them because the first letters are "Noob". Sorry if it doesn't make sense. It's really hard for me to explain this. xD Anyways, thanks for reading!

local debounce = false

function onTouched(hit)
	if not debounce then
		debounce = true
		if hit.Parent.Name == "Noob" then
			hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 5
			wait(0.5)
			debounce = false
		end
	end
end

script.Parent.Touched:connect(onTouched)

3 comments

1

if hit.Parent.Name:sub(1, 4) == "Noob" then

0

What if the noob has a complicated name after it? Like "Noob Lv 1 HP 100/100"

0

OH! It works I put "sub" as "Sub" so it wasn't working lol. Thanks.