So im making a hair editor and im making it so if the player touches the hairpiece /accessory it gets copied to the players character, but for some reason if the player does this about 3 times or touches it 3 times, they get teleported within the hair, for some reason instead of copying the original accessory is put inside the player and I have no idea why theres no errors heres a video

heres the code when the player touches the hair

local accessory = script.Parent
local handle = accessory:WaitForChild("Handle")

local debounce = false

handle.Touched:Connect(function(hit)
	if not debounce then
		debounce = true
		local char = hit:FindFirstAncestorWhichIsA("Model")
		local plr = game.Players:GetPlayerFromCharacter(char)
		if plr and not char:FindFirstChild(accessory.Name) then
			local newAccessory = accessory:Clone()
			
			newAccessory:FindFirstChild("Handle").Anchored = false
			newAccessory.Parent = char
			newAccessory:FindFirstChildWhichIsA("Script", 1):Destroy()
			newAccessory.Name = "Hair"
			
			
		end
		wait(5)
		debounce = false
	end
end)

1 comment

0

There is no video