I am having trouble creating a script that goes in a part, kills a player, and then replicates a child of the plrModel and puts it in the new torso of the living character. No portion of the code executes properly.
local plr = game.Players.LocalPlayer
local plrModel = game.ReplicatedStorage:WaitForChild(plr.Name)
local particle = plrModel:FindFirstChild()
function onTouched(hit)
print("death test")
local human = hit.Parent:FindFirstChild("Humanoid")
if human ~= nil then
human.Health = 0
end
end
function touchedMe(hit)
print("test")
if particle ~= nil then
print("test1")
local newClone = particle:Clone()
local newCharacter = game.Workspace:WaitForChild("plr.Character"):WaitForChild("UpperTorso")
newClone.Parent = newCharacter
print("test2")
end
end
script.Parent.Touched:connect(onTouched)
script.Parent.Touched:connect(touchedMe)
Nothing in this script is executing. Its purpose, is to clone any particle from the PlayerModel located in ReplicatedStorage after the player dies. Do you know how I could fix it? The player is not dying.

7 comments
Is this a server script?
No, it is inside of a part.
Then of course it wont work. Local scripts must be a descendant of a player character in order to execute under workspace.
And do you mind indenting your code so we can actually read it? Plus studio auto indents so how do you not indent your code. It helps us read it and you too
I indented it, but what should I do with it in order to fix this?
Make it a script and on your own get the player, as LocalPlayer is seen as nil by the server
I have gotten player on my own, but still nothing executes.