How do you make a trap code, because I only know how to make them die, will this help u answer :
script.Parent.Touched:Connect(function(hit) local character = hit.Parent local human = character:FindFirstChild("Humanoid") local player = game.Players:GetPlayerFromCharacter(character) if player and human.Health > 0 then human.Health = 0 end end)
Humanoids have a sit property, which you can use to make the "Slip"
script.Parent.Touched:Connect(function(hit) local character = hit.Parent local human = character:FindFirstChild("Humanoid") local player = game.Players:GetPlayerFromCharacter(character) if player and human.Health > 0 then human.Sit = true end end
Should wok, if not, then I dunno lol.
Put this code in the block! If this helps please consider giving this an accept and an upvote if helpful!
--[[ I have included a breakdown of what each part does ]]-- local trapPart = script.Parent -- setting the name for the kill brick trapPart.CanCollide = false -- makes the killbrick hit-able local function onPartTouch(otherPart) -- function that finds what touched the killbrick local partParent = otherPart.Parent --finds the player local humanoid = partParent:FindFirstChildWhichIsA("Humanoid") --finds the players health stats if humanoid then -- Set player's health to 0 aka killing them humanoid.Health = 0 end end trapPart.Touched:Connect(onPartTouch)