local lplayer = game.Players.LocalPlayer local HumT = lplayer.Character.Torso local RepStore = game:GetService("ReplicatedStorage") local Players = game:GetService("Players") function OnPlayerAdded(plr) print("Hello!") local part2 = RepStore.Blocky:Clone() local weld = Instance.new("Weld") weld.Part0 = part2 HumT.Parent = lplayer part2.Parent = HumT weld.Part1 = HumT weld.C0 = CFrame.new(0,0,0) weld.C1 = CFrame.new(0,0,0) end for _,v in pairs(Players:GetPlayers()) do OnPlayerAdded(plr) end
It kills me when I try to weld a part to the Character's Torso. Each time I respawn.
You set the player's torso to the player, which is why it kept killing them. The torso doesn't need to be parented. You also forgot to set the parent of the weld.
And I'm not sure why it even worked, because in lines 31-33, you used 'plr' which wasn't defined. If you're trying to loop through the players and do it for all of them, then substitute plr with v, as I did. You should also connect the function to the actual player added event, which I assume is what you wanted to do from 'OnPlayerAdded', as right now it'll only run once.
local lplayer = game.Players.LocalPlayer local HumT = lplayer.Character.Torso local RepStore = game:GetService("ReplicatedStorage") local Players = game:GetService("Players") function OnPlayerAdded(plr) print("Hello!") local part2 = RepStore.Blocky:Clone() part2.Parent = game.Workspace local weld = Instance.new("Weld") weld.Parent = part2 weld.Part0 = part2 part2.Parent = HumT weld.Part1 = HumT weld.C0 = CFrame.new(0,0,0) weld.C1 = CFrame.new(0,0,0) end for _,v in pairs(Players:GetPlayers()) do OnPlayerAdded(v) end game.Players.PlayerAdded:connect(OnPlayerAdded) -- Add this if you want it to run the function when a player is added.