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

Any tips on how to make a kill script for begginers?

I have recently started coding, and following the courses on Studio+. The problem with this is that there is no course on making a obby. I have seen other threads about this but they require higher coding skills. Any scripts that could include the "if" statement? Cheers!

2 comments

0

I edited my answer. I used "." instead of ":"

0

.

3 answers

✓ Accepted answer

yall are making this hard just use this

inside the killpart

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		hit.Parent.Humanoid:TakeDamage(100) -- Amount of damage
	end
end)

Use Humanoid: TakeDamage

"script" inside the Killbrick


script.Parent.Touched:Connect(function(p)


p.Parent.Humanoid:TakeDamage(100)
end)

There Test it Out, i haven't tested it yet if there's problem just comment again

13 comments

0

This script does not work. The error is - "Humaniod" is not a valid member of the model.

0

It Works You should Put a ordinary script inside the part and not anywhere else because the script calls the Part because of that script.Parent so it should be the Child of the "Part"

0

Don't mind that error try stepping on that part it will surely kills you, its just the script runs even before you join the game

0

Thank you! It works.

0

told ya

0

When I copy and paste the script, it works. But when I type the script myself, it does not work. How do I fix this?

0

maybe there's wrong Capitalization/Spelling on it

0

Okay I will check.

0

This is my script. - script.Parent.Touched:Connect(function(p) p.Parent.Humanoid:TakeDamage(100) end)

0

whats the problem with it?

0

You should add "if" to see if the part that touches the brick really is a child of a player's character. Then you won't get the errors

0

You mean - if script.Parent.Touched:Connect(function(p) p.Parent.Humanoid:TakeDamage(100) end)

0

This is the error message I got when doing that script. - 18:35:49.841 - Workspace.Part.Script:5: Expected 'then' when parsing if statement, got

EDITED Put this in a script inside a part:

local p = script.Parent
local d = {}
p.Touched:Connect(function(hit)
    local c = hit.Parent
    local h = c:WaitForChild("Humanoid")
    local p = game.Players:GetPlayerFromCharacter(c)
    if p and h and not d[c] then
        d[c] = true
        h:TakeDamage(100) -- set to as much as you want, 100 will kill the player.
        wait(2)
        d[c] = nil
    end
end)

If that helped please accept this answer.

All the best,

PrismaticFruits

6 comments

0

Have you ever used this script? It is not working.

0

Now try.

0

Thank you! This is working.

0

Can you please accept this answer?

0

How do I?

0

You just did it lol.

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