Hello everybody
-
I want the copied car (newCar) to be destroyed when a certain button is clicked.
-
The problem is that it doesn’t work :
local CarParams = game.ReplicatedStorage:WaitForChild("GetCarParams"):InvokeServer(script.Parent.Name)
local CarImage = script.Parent.CarImage
local ShowPurchaseFrame = script.Parent.Parent.Parent.Parent.ShowPurchaseFrame
script.Parent.CarName.Text = CarParams.Name
script.Parent.Cost.Text = CarParams.Cost
script.Parent.MouseButton1Down:Connect(function()
ShowPurchaseFrame:Fire(CarParams.Name, CarParams.Cost, CarParams.Power, script.Parent.CarImage)
script.Parent.Parent.Parent.Coupes.Visible = false
local newCar = game.ReplicatedStorage.ShopCars.Agera:Clone()
newCar.Parent = workspace
script.Parent.Parent.Parent.Parent.PurchaseFrame.BackButton.MouseButton1Click:Connect(function()
newCar:Destroy()
end)
end)
- i’ve tried to delete the newCar but it doesn’t work
Can someone help me, Thanks !