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

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

Asked by
pevdn 32
4 years ago

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!

0
I edited my answer. I used "." instead of ":" PrismaticFruits 842 — 4y
0
. PrismaticFruits 842 — 4y

3 answers

Log in to vote
1
Answered by 4 years ago

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)
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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

0
This script does not work. The error is - "Humaniod" is not a valid member of the model. pevdn 32 — 4y
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" MachoMasterKirby 2 — 4y
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 MachoMasterKirby 2 — 4y
0
Thank you! It works. pevdn 32 — 4y
View all comments (9 more)
0
told ya MachoMasterKirby 2 — 4y
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? pevdn 32 — 4y
0
maybe there's wrong Capitalization/Spelling on it MachoMasterKirby 2 — 4y
0
Okay I will check. pevdn 32 — 4y
0
This is my script. - script.Parent.Touched:Connect(function(p) p.Parent.Humanoid:TakeDamage(100) end) pevdn 32 — 4y
0
whats the problem with it? MachoMasterKirby 2 — 4y
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 Spjureeedd 385 — 4y
0
You mean - if script.Parent.Touched:Connect(function(p) p.Parent.Humanoid:TakeDamage(100) end) pevdn 32 — 4y
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 <eof> pevdn 32 — 4y
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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

0
Have you ever used this script? It is not working. pevdn 32 — 4y
0
Now try. PrismaticFruits 842 — 4y
0
Thank you! This is working. pevdn 32 — 4y
0
Can you please accept this answer? PrismaticFruits 842 — 4y
View all comments (2 more)
0
How do I? pevdn 32 — 4y
0
You just did it lol. PrismaticFruits 842 — 4y

Answer this question