Flood escape minigame not working

i have this killbrick that goes up in my game that acts as the flood but the brick is refusing to kill the player. anyone help??

local flood  = script.Parent
local gamestatus = game.ReplicatedStorage.GameStatus

countdown = 5
for i = countdown, 0, -1 do
	gamestatus.Value = i
	wait(1)
end

for i = -152.75, -73.75, 1 do
	flood.Position = Vector3.new(82.545, i, -106.735)
	wait(1)
end

local function steppedOn(part)
	local parent = part.Parent
	if game.Players:GetPlayerFromCharacter(parent) then
		parent.Humanoid.Health = 0
	end
end

while wait() do
	flood.Touched:Connect(steppedOn)
end
1 Like

Hey, you are connecting an event to a function every frame just remove the while loop.

1 Like

i removed the while loop and its still not killing

Try printing things in the function

What errors are you getting exactly?

it doesnt give any errors it just doesnt kill the player

script.Parent.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild(“Humanoid”) then
        hit.Parent.Humanoid.Health = 0
    end
end)

Try doing this:

script.Parent.Touched:Connect(function(Part)
    if game.Players:GetPlayerFromCharacter(Part.Parent) then
		Part.Parent:WaitForChild("Humanoid").Health = 0
	end
end)

--Put your code here.
1 Like