function Touch() game.Workspace.Player["Right Arm"]:Destroy() wait(1) game.Workspace.Player["Left Arm"]:Destroy() wait(1) game.Workspace.Player["Left Leg"]:Destroy() wait(1) game.Workspace.Player["Right Leg"]:Destroy() wait(4) game.Workspace.Player["Head"]:Destroy() end script.Parent.Touched:connect(Touch)
Be aware I just started working with more complex Player scripts. I'm sure it's something obvious I'm missing, but I can't seem to find it.
You're always destroying the body parts of the same model - Player
. What if there is no Player inside of workspace? You have to reference the character according to what the Touched
event returns. The Touched event returns whatever was touched.
function Touch(hit) --Make sure it's a player if hit.Parent:FindFirstChild("Humanoid") then char = hit.Parent char["Right Arm"]:Destroy() wait(1) char["Left Arm"]:Destroy() wait(1) char["Left Leg"]:Destroy() wait(1) char["Right Leg"]:Destroy() wait(4) char["Head"]:Destroy() end end script.Parent.Touched:connect(Touch)
Note: The character will die upon the removal of the 'Head' instance.