I’m making a trading system and I want it to be like when I click the button, the button destroys itself, However, this doesn’t work.
Script:
local clonedTemplate = tradeFrame.Player1.PetsFrame.SelectPets.Template:Clone()
clonedTemplate.Parent = tradeFrame.Player1.PetsFrame.SelectPets
clonedTemplate.Name = v.Name
clonedTemplate.Visible = true
clonedTemplate.PetName.Text = v.Name
local Model3D = module3D:Attach3D(clonedTemplate:WaitForChild('Display'),petModel)
Model3D:SetDepthMultiplier(1.2)
Model3D.Camera.FieldOfView = 5
Model3D.Visible = true
runService.RenderStepped:Connect(function()
Model3D:SetCFrame(CFrame.Angles(0,tick() % (math.pi * 2),0) * CFrame.Angles(math.rad(-10),0,0))
end)
clonedTemplate.TextButton.Activated:Connect(function()
clonedTemplate:Destroy()-- doesn't work?
end)