I wanted to make a small thing that kills a player, and then randomly it doesn’t detect the part in there.
local TweenService = game:GetService("TweenService")
local killing = false
function kill(person)
killing = true
local humanoid = person:FindFirstChild("Humanoid")
local humanoidRootPart = person:FindFirstChild("HumanoidRootPart")
if humanoid and humanoidRootPart then
humanoid.PlatformStand = true
humanoidRootPart.Anchored = true
TweenService:Create(script.Parent.Hand,TweenInfo.new(1,Enum.EasingStyle.Quad,Enum.EasingDirection.In),{CFrame = script.Parent.Hand.ToGoPos.CFrame}):Play()
wait(1.5)
local effect = script.Parent.Blood:Clone()
person.Head.Neck:Destroy()
effect.Parent = person.Head.NeckRigAttachment
person.Head.CanCollide = true
script.Parent.Hand.Kill:Play()
TweenService:Create(script.Parent.Hand, TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut), {CFrame = script.Parent.Hand.MainPos.CFrame}):Play()
wait(0.5)
humanoid.PlatformStand = false
humanoidRootPart.Anchored = false
end
killing = false
end
script.Parent.Trigger.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and not killing then
if hit.Name == "Head" then
kill(hit.Parent)
end
end
end)