So i tried to make a part that will killed you if you touch it This is the script
script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid").Health the hit.Parent:FindFirstChild("Humanoid).Health = hit.Parent:FindFirstChild("Humanoid").Health - 100 local part = workspace.Part script.Parent:Destroy() local copy = part:Clone() copy.Parent = part.Parent copy.Position = Vector3.new(10,20,10) end)
Last time i tried this , The part keep cloning a part and crashed my studio instantly
you can add a variable that makes the function run once like this :
local already_cloned = false -- we will use this variable to make the script excute once only. script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid").Health then if already_cloned == false then -- if we havent cloned before then hit.Parent:FindFirstChild("Humanoid").Health = hit.Parent:FindFirstChild("Humanoid").Health - 100 local part = workspace.Part script.Parent:Destroy() local copy = part:Clone() copy.Parent = part.Parent copy.Position = Vector3.new(10,20,10) already_cloned = true --after we clone once then "already_cloned" should be set to true since we already cloned it and dont want to clone again. end end end)