I'm currently working on a game where the player is controlled via a custom starter character. I built the rig in a way in which the player head and arms are connected by hinges. Whenever the RootWeld is destroyed by a bomb, I want to kill the player, although my script seems to not work. I'm somewhat of a noobie when it comes to scripting, so if anyone has any advice onto how to fix this easily, it would be greatly appreciated! Also, if it helps at all, I'm running this from a LocalScript in StarterCharacterScripts.
local character = script.Parent
local root = character.Torso.RootWeld
local neck = character.Torso.Neck
repeat until true do
if root == nil then
character:BreakJoints()
print("root destroyed")
end
wait()
end
EDIT: The RootWeld is inside the Torso. It keeps the HumanoidRootPart attached to the player.

2 comments
After a while of experimenting with the script, I couldn't get it to work. I don't know if it's my weird faulty code or because I'm new to scripting.
Any output?