I’ve created a script that looks for a part called “KillBrick” when this part is touched the player would have a 1 in 5 chance of taking damage.
I’ve tried experimenting around and it seems to not work (doesn’t kill the player), and I’m unsure of what exactly is the problem since I get no errors from it.
I’ve tried changing the chance and have looked over the code but I don’t see any issues with it.
(this script is within the ServerScriptService)
local Humanoid = game.Workspace.KillBlock.Parent:FindFirstChild("Humanoid")
local killChance = math.random(1,5)
game.Workspace.KillBlock.Touched:Connect(function(kill)
if Humanoid and killChance == 1 then
Humanoid.Health = 10000
wait(3)
Humanoid.Health = 300
else
print("Fail!")
end
end)