Basically, I am making a car shop, shown here http://prntscr.com/6bx9ln and when you click one of those buttons a buy button appears at the right panel. That works, but my problem is with the buy button. When I click the buy button the car spawns and then crumbles, the script is here.
player = script.Parent.Parent.Parent.Parent.Parent
cost = 5000
script.Parent.MouseButton1Click:connect(function()
leaderstats = player:FindFirstChild("leaderstats")
if leaderstats then
money = leaderstats:FindFirstChild("Money")
if money then
if money.Value >= cost then
spawncar = game.Lighting["CiviCar"]:clone()
spawncar.Parent = workspace
spawncar.MakeJoints()
player.leaderstats.Money.Value = player.leaderstats.Money.Value - 5000
script.Parent.Text = "Bought"
else
script.Parent.FontSize = 14
script.Parent.Text = "Not enough $"
return
end
end
end
end)
So yes, this spawns the car, and takes the money away but the car crumbles when spawned. This is the heirachy http://prntscr.com/6jjrbw and and this is the heirachy of the brick that when touched brings up the whole GUI http://prntscr.com/6jjrkx. Thanks.

1 comment
Aqua's answer is incorrect. Please look at mine.