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

Whats wrong with my kill script? I can only find ontouch function scripts

Asked by 4 years ago
Edited 4 years ago

Hi, I made this script and it doesnt work whats up with it? I ve been searching for kill scripts for so long now and I only find ontouch scripts

while 0<1 do
    wait(5)
    local humanoid = game.Parent:FindFirstChild("Humanoid")
    humanoid.Health = 0
end

its probably the 'game.' but i dont know what to put there instead i tried script. but nothing

Thanks again for your time!

2 answers

Log in to vote
0
Answered by 4 years ago

Alright, I can see that you dont want a kill brick script. You want to kill a player without him touching a brick or smth.

Like the other guy said, you didnt provide enough information in the script to know which player to kill.

the correct thing would be like this in a normal script in serverscriptservice:

TargetPlayer = --The Players name you want to kill.

while true do
wait(5) -- every 5 seconds the player will die
game.workspace.TargetPlayer.Humanoid.Health = 0
end

1
Awesome perfect thanks so much!..Yeah im new in programming i have no idea what im doing learning as i go. Mast3rStRix 43 — 4y
0
But how do i target all players? Mast3rStRix 43 — 4y
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

That will just loopkill a player. You didn't provide enough information for anyone to help you.

Multiple other things too. game.Parent is not accessible. Game is a roblox default varriable and cannot be overwritten.

If you want a part to kill a player:

game.Workspace.Part.Touched:Connect(function(part)
    if part.Parent:FindFirstChild("Humanoid") then
        part.Parent.Humanoid.Health = 0
    end
end)
0
No i dont want a part to kill a player as i stated in the question discription ("i can only find ontouch kill scripts") i want the player to be killed on loop Mast3rStRix 43 — 4y
0
I should have also just stated that i need a simple kill script but im too dumb haha . Thanks for helping Mast3rStRix 43 — 4y

Answer this question