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

Help How Do i Make a Player die if they get the number 1?

Asked by 3 years ago

i tried to fix this its like when u click a block it gives u a random number i tried for 2 hours trying to fix this but couldnt

script.Parent.ClickDetector.MouseClick:Connect(function(click)

    local imrandom = math.random(1,12)

    print(imrandom)
    function kil(player)
    if imrandom == 1 then

            local human = player.Character.Humanoid
                human.health = 0


end
    end

end)

and i inserted a click detector too

also just realised i lost the other code

1 answer

Log in to vote
1
Answered by
JesseSong 3916 Moderation Voter Community Moderator
3 years ago

Here's a fixed version of your code. You have some deprecated practices like the use of health which is supposed to be Health. And a random function that is not needed.

Fixed Script

script.Parent.ClickDetector.MouseClick:Connect(function(click)

    local imrandom = math.random(1,12)
    print(imrandom)
        if imrandom == 1 then

            local human = click.Character.Humanoid
            human.Health = 0


        end
    end)

0
thx ghgg471 8 — 3y
Ad

Answer this question