Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I think I messsed this up can you help?

Asked by 10 years ago

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

Log in to vote
0
Answered by
Tesouro 407 Moderation Voter
10 years ago

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.

0
Ok I guess im still a begginer chill22518 145 — 10y
0
yeah, try some wiki tutorials and learn these stuff, it's not hard Tesouro 407 — 10y
Ad

Answer this question