The following script, will not delete the BasicUpgrader1B for some reason, and i do not quite know why:
model1 = script.Parent.Parent.Parent.BasicUpgrader1B model2 = script.Parent.Parent.Parent.BasicUpgrader1A model3 = script.Parent.Parent.Parent.BasicUpgrader1C UpgradeCost = 150 upgradeStuff1 = model1:clone() upgradeStuff2 = model2:clone() upgradeStuff3 = model3:clone() wait(1) model1:remove() model2:remove() model3:remove() owner = script.Parent.Parent.Parent.OwnerName local ting = 0 function onTouch(hit) if ting == 0 then ting = 1 check = hit.Parent:FindFirstChild("Humanoid") if check ~= nil then if hit.Parent.Name == owner.Value then local user = game.Players:GetPlayerFromCharacter(hit.Parent) local stats = user:FindFirstChild("leaderstats") if stats ~= nil then local cash = stats:FindFirstChild("Cash") if cash.value > (UpgradeCost-1) then cash.Value = cash.Value - UpgradeCost upgradeStuff1.Parent = script.Parent.Parent.Parent upgradeStuff2.Parent = script.Parent.Parent.Parent upgradeStuff3.Parent = script.Parent.Parent.Parent script.Parent.Parent:remove() end end end end ting = 0 end end script.Parent.Touched:connect(onTouch)
This is my explorer view: http://pasteboard.co/CHHkQRgVh.png
The console output's this: http://pasteboard.co/CHI7TUewb.png
The problem is most likely that the script is executing before the model has even loaded in.
We can fix this by waiting for each individual model before carrying out the function.
model1 = script.Parent.Parent.Parent:WaitForChild("BasicUpgrader1B") model2 = script.Parent.Parent.Parent:WaitForChild("BasicUpgrader1A") model3 = script.Parent.Parent.Parent:WaitForChild("BasicUpgrader1C") UpgradeCost = 150 upgradeStuff1 = model1:clone() upgradeStuff2 = model2:clone() upgradeStuff3 = model3:clone() wait(1) model1:remove() model2:remove() model3:remove() owner = script.Parent.Parent.Parent.OwnerName local ting = 0 function onTouch(hit) if ting == 0 then ting = 1 check = hit.Parent:FindFirstChild("Humanoid") if check ~= nil then if hit.Parent.Name == owner.Value then local user = game.Players:GetPlayerFromCharacter(hit.Parent) local stats = user:FindFirstChild("leaderstats") if stats ~= nil then local cash = stats:FindFirstChild("Cash") if cash.value > (UpgradeCost-1) then cash.Value = cash.Value - UpgradeCost upgradeStuff1.Parent = script.Parent.Parent.Parent upgradeStuff2.Parent = script.Parent.Parent.Parent upgradeStuff3.Parent = script.Parent.Parent.Parent script.Parent.Parent:remove() end end end end ting = 0 end end script.Parent.Touched:connect(onTouch)