- Infinite yield possible on 'Workspace.player.Name.DiamondSword:WaitForChild("Handle")' when making the gamepass to work

While i was a making the gamepass to work, i got this error: - Infinite yield possible on ‘Workspace.player.Name.DiamondSword:WaitForChild(“Handle”)’ , after when i respawned my character. How can I fix this error? I got the model from the toolbox btw.
Here’s my script:

local MarketPlaceService = game:GetService("MarketplaceService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Sword = ReplicatedStorage:WaitForChild("DiamondSword")

local gamePassId = 10967930

MarketPlaceService.PromptGamePassPurchaseFinished:Connect(function(player, purchasedPassId, purchaseSuccess)
	
	if purchaseSuccess == true and purchasedPassId == gamePassId then
		print(player.Name.. " purchased the Sword GamePass")
        Sword.Parent = player.Character		
	end
end)


game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		local character = game.Workspace:WaitForChild(player.Name)
	local hasPass = false
	local success, errorMessage = pcall(function()
		hasPass = MarketPlaceService:UserOwnsGamePassAsync(player.UserId, gamePassId)
	end)
      
	if  hasPass then
		print("player already have the gamepass")
		Sword.Parent = character
		character.Humanoid.WalkSpeed = 30
	end
	end)	
end)


The error you mention is not in the script that you posted.

Regardless, the problem is probably that you keep reparenting the same sword object. Did you mean to Clone() it?

Ahh, so the problem was that i have to clone the part first.