Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I tried to make a script for destroying the upper torso of players but it didnt work?

Asked by 4 years ago
Edited 4 years ago

script.Parent.Touched:Connect(function(hit) if game.Players:GetPlayerFromCharacter(hit.Parent)then hit.Player.Humanoid.UpperTorso.Destroy() end end)

2 answers

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago
-- Server Script

local Main = script.Parent -- Our part that we'll check if it's touched by a player
local Players = game:GetService("Players")

Main.Touched:Connect(function(Hit) -- When part is touched
local Player = Players:GetPlayerFromCharacter(Hit.Parent) -- Our player

if Player.Character then -- If the character exists
  Player.Character:BreakJoints() -- Breaking every joint in the player causing the player to reset
 end
end)

Since your question isn't constructive at all without any information about the script you provided and the code you've sent seems to be a death on-touch for a part.

So there's the fixed code, for future references please make your questions constructive enough for other people to understand your problem.

0
he wants to destroy the upper torso not the body TNTIsLyfe 152 — 4y
0
Not every character has an UpperTorso. It is a far better option to destroy the HumanoidRootPart because the Humanoid will die if its root part is nil. However, BreakJoints() is more convenient. DeceptiveCaster 3761 — 4y
0
Why did you accept this!? Just set the torso transparency to 1! Use your brain people! PrismaticFruits 842 — 4y
Ad
Log in to vote
0
Answered by
Xapelize 2658 Moderation Voter Community Moderator
4 years ago

Sorry, a player torso was not able to delete. The people will die immediately if the torso was removed.

You better use other ways to do your game or try another way to figure out.

Answer this question