Model being deleted as soon as it enters workspace

player.CharacterAdded:Connect(function(character: Model) 
		local OC = Omnitrix:Clone()
		local Arm:Part = character:WaitForChild("LeftLowerArm")
		OC.PrimaryPart.ArmWeld.Part1 = Arm
		OC.PrimaryPart.CFrame = Arm.CFrame
		print(os.clock())
		OC.Parent = Arm
		OC.PrimaryPart.Destroying:Once(function()print(os.clock()) end)
		end)

The parts in the model are welded (but they do not move even though the part that they are welded has its CFrame changed which is strange) and I tested to see if the parts in the model are deleted because they are too low which is not the case. For a reason I don’t know, the model itself is being deleted half of a millisecond after it enters workspace. :frowning:

2 Likes

Hi. I was unable to reproduce the problematic outcome. The script functioned correctly and welded provided model to my character’s arm.

If you don’t mind, could you provide a .rbxl place file so I can further investigate?

Copy.rbxl (265.9 KB)

I just unanchored everything in the model and it seemed to work fine. The rest of the model was just floating off in space but wasn’t getting voided because it was anchored.
image

Hm… For me, the model disappeared regardless of the parts being anchored. :frowning:

WIthout anchoring, the model seems to be deleted faster.

Can you send me a copy of your file please?

Copy.rbxl (265.9 KB)

Here’s what I did and it worked for me, the main solution was waiting for the character appearance to fully load and then add the

  • omnitrix

onto the character.

PlayersService.PlayerAdded:Connect(function(player: Player) 
	-- Set up attributes when player joins the game
	player:SetAttribute("Blocking",false)
	player:SetAttribute("Stunned",false)
	player:SetAttribute("Damage",10)
	player:SetAttribute("Stamina", MaxStamina)
	player:SetAttribute("MaxStamina", MaxStamina)
	player:SetAttribute("Sprinting", false)
	StaminaSystem(player)
	player.CharacterAdded:Connect(function(character: Model) 
		player.CharacterAppearanceLoaded:Wait()
		local OC = Omnitrix:Clone()
		local Arm:Part = character:WaitForChild("LeftLowerArm")
		OC.PrimaryPart.ArmWeld.Part1 = Arm
		OC.PrimaryPart.CFrame = Arm.CFrame
		print(os.clock())
		OC.Parent = Arm
		OC.PrimaryPart.Destroying:Once(function()print(os.clock()) end)
		for _, obj in OC:GetDescendants() do
			if not obj:IsA('BasePart') then continue end
			obj.Anchored = false
		end
	end)
	
end)

You could also just do:

player.CharacterAppearanceLoaded:Connect

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.