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)

6 comments
Within your while loop, you destroy the part, which is the original part. I suggest cloning it or creating a new part using Instance because this script will just name the part and destroy it..
It should name the part then when you click it again it destroys the part.
I see what you meant shawnyg.
Mk, great. Tell me if you need additional help.
I actually do, I have this much so far it spawns the brick then you can despawn it and thats it... http://prntscr.com/42n7f5
Nevermind it