I am trying to make a part be welded to any character that joins the game and whenever a character respawns, but it just quite isn't working. Got an error that keeps saying "Torso is not a valid member of player" but i don't really don't know how to define the local player that spawned, if that makes any sense.
game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(character) print("Lol, I respawned") local part = Instance.new("Part") part.Shape = Enum.PartType.Block part.Name = "Assassin Block" part.Transparency = 0 part.Size = Vector3.new(2,1,2) part.CanCollide = false local weld = Instance.new("Weld", part) weld.Part0 = character.Torso weld.Part1 = part weld.C1 = CFrame.new(0,0,0) part.Parent = game.Workspace part.Position = player.Torso.Position end) end)
You have to make the script wait for your part to be created.
game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(character) print("Lol, I respawned") local part = Instance.new("Part",game.Workspace) part.Shape = Enum.PartType.Block part.Name = "AssassinBlock" part.Size = Vector3.new(2,1,2) part.CanCollide = false repeat wait() until game.Workspace.AssassinBlock ~= nil local weld = Instance.new("Weld",game.Workspace.AssassinBlock) weld.Part0 = character.Torso weld.Part1 = part weld.C1 = CFrame.new(0,0,0) part.Position = character.Torso.Position end) end)