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

Killbrick spinner doesn't kill the player?

Asked by 3 years ago

I have 2 questions but lets talk about that at the end. My killbrick spinner does spin but doesn't deal damage. It is a spinner with some CylindricalConstraint thingy that can move the player. The killbrick in the spinner is named "Instant KillBrick" and I can't find anything wrong with it.

So here is the script I guess:

local Debounce = false

for _,v in pairs(workspace:GetDescendants()) do
    if v:IsA("BasePart") and v.Name == "Instant KillBrick" then
        v.Touched:Connect(function(hit) 
            if Debounce == false then
            Debounce = true
            local Player = hit.Parent:FindFirstChild("Humanoid")
                if Player then
                    Player:BreakJoint()
                    Debounce = false
                end
            end
        end)
        end
end

3 answers

Log in to vote
0
Answered by 3 years ago

You have to set Debound to true after detecting it is Player! Read your logic again. what happens if it touches non-humanoid ? it sets Debounce to true and that wont be changed again.

0
It works! DecalMaker2468 21 — 3y
0
not only that you also fixed my another problem that I can't explain it here DecalMaker2468 21 — 3y
Ad
Log in to vote
0
Answered by
mroaan 95
3 years ago

instead of all this create a function with an event called "Touched" so whenever its touched its gonna do something

local instantKillBrick = game.Workspace["Instant KillBrick"]
local divideBy = 3

instantKillBrick.Touched:Connect(function(hit)
    local player = hit.Parent:FindFirstChild("Humanoid")
    if player then
        player.Health -= divideBy
    end
end)
Log in to vote
0
Answered by 3 years ago

Making Brick Detector

Instead of using that method, try using mine!

Its simple! Follow This Tutorial:

1. Make A Kill Brick

You can use brick and color it red and set material to Neon!

2. Make A Folder

Make a folder in workspace, then name it yourself! Then put your Kill Brick inside of it.

3. Make A Kill Script

You can copy my script:

local KillBrick = workspace:FindFirstChild("Folder Name"):GetChildren() --Change Folder Name To Your Folder Name!
local Debounce = false
local Damage = 10 --Total of the damage!

while wait() do
    for i = 1, #KillBrick do
        KillBrick[i].Touched:Connect(function(Hit)
            if Hit.Parent:FindFirstChild("Humanoid")and Debounce == false then
                Debounce = true
                Hit.Parent.Humanoid.Health -= Damage
                wait(0.5) --Time of Working Again!
                Debounce = false
            end
        end)
    end
end

After That, Put it on ServerScriptService or Workspace!


Thats all you need to do!

Comment Down Bellow If You Find Any Problem!

Thank's for Reading!

0
This does work but it will be performance heavy as it is creating a new touched event every wait. XviperIink 428 — 3y

Answer this question