Im trying to weld a part on the character so that i can make a script that kills other players that come close but I cant get it to work. This is the script im using :
local charAdded = function(char)
local a = script:WaitForChild('hitbox'):Clone()
local w = Instance.new('Motor6D')
w.Part0 = char:WaitForChild('UpperTorso')
w.Part1 = a
w.Parent = char['UpperTorso']
a.Parent = char
end game:GetService('Players').PlayerAdded:Connect(function(plr)
if plr.Character then
charAdded(plr.Character)
end
plr.CharacterAdded:Connect(charAdded)
end)
I put the part named "hitbox" inside the script thus having the script being the parent of 'hitbox' but the "hitbox" still just stays on the map. notes:my character is r15 the game settings avatar type is r15 This is what happens............ This is kind of what i want:..........
THE hitbox part Doesnt Stick to the player I want it to move along with the character but it wont

2 comments
Hello thanks for your answer! In the output i get this error: 16:46:26.209 - ServerScriptService.aweld:11: attempt to index nil with 'Head' Could you send me the rblx file please?
Hi again i just realised that my own script works but only works with a basic square and doesnt work for example with girl, boy torso. Is there a way to fix this?