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

I think I messsed this up can you help?

I am trying to make a script that if there is only 1 left in the Model he wins

function onTouched(Chief) --Chief is the Model
	h = Chief.Parent:findFirstChild("Humanoid")
	if h == 1  then
		x = Instance.New("Message", Workspace)
		wait(0.1)
		x.Text = h.Name.."Has won the round!"
		wait(2)
		x.Text = ""
	end
end

1 answer

✓ Accepted answer

FindFirstChild will get only one child, and h is not the number of childs. Use GetChildren instead.

Also, you didn't run the function, so I suggest you to know more about Events and Functions. And you can't use Touched function on a model, it has to be a part.

Please, try learning more about Lua before making questions.

2 comments

0

Ok I guess im still a begginer

0

yeah, try some wiki tutorials and learn these stuff, it's not hard

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