I'm pretty sure my problem is debounce not being used correctly. The despawn part doesn't work and despawns the part for like 1 second. If someone could fix this that'd be great thanks.
debounce = false script.Parent.Text = "Spawn Pet" script.Parent.MouseButton1Down:connect(function() if debounce == true then return end debounce = true local plr = script.Parent.Parent.Parent.Parent.Character owner = script.Parent.Parent.Parent.Parent.Name part = Instance.new("Part", Workspace) part.Anchored = true while wait(0.1) do part.CFrame = CFrame.new(plr.Torso.Position + Vector3.new(5,-2.4,5)) script.Parent.Text = "Despawn Pet" part.Name = (owner.."'s Pet") script.Parent.MouseButton1Down:connect(function() part:Destroy() debounce = false end) end end)