Okay so I have been trying to make this car model I have made work as a buy able model to get for real money. The car is called the Tesla, my only problem is when I buy the model it spawns broken and out of shape. please help. Here is the script:
------------------------------------------------------------------------------------------------------------------------- model = script.Parent.Parent.Parent.Tesla --Item name Upgradecost = 1000 --Change cost to upgrade ------------------------------------------------------------------------------------------------------------------------- upgradeStuff = model:clone(Upgrader1)-- model:remove() --remove the ingame model. We saved a clone for later. local ting = 0 --debouncer function onTouched(hit) if ting == 0 then --check for debounce ting = 1 --activate debounce check = hit.Parent:FindFirstChild("Humanoid") --try to find the human that touched the button if check ~= nil then --if toucher is a human then to following local user = game.Players:GetPlayerFromCharacter(hit.Parent) --get player from touching human local stats = user:findFirstChild("leaderstats") --Find moneyholder if stats ~= nil then --If moneyholder exists then local cash = stats:findFirstChild("Money") --Get money if cash.Value > (Upgradecost-1) then --If there is enough money then cash.Value = cash.Value - Upgradecost --remove cash upgradeStuff.Parent = script.Parent.Parent.Parent --put the upgrade into the game script.Parent.Parent:remove() -- remove the upgrade button (in case of one-upgrade only) end end end ting = 0 --remove debounce end end script.Parent.Touched:connect(onTouched) --start checking for touchers
Here are the links for proof:
C:\Users\Solrac\Documents\ROBLOX\Game Stuff\Astura with buy model button at start.png
C:\Users\Solrac\Documents\ROBLOX\Game Stuff\Astura afterwards (after bought using money).PNG
You can use the MakeJoints
Method, Now to add it to your script.
--> line 27-33 upgradeStuff.Parent = script.Parent.Parent.Parent --put the upgrade into the game upgrade:MakeJoints() script.Parent.Parent:remove() -- remove the upgrade button (in case of one-upgrade only) end end end
MakeJoints() Maybe
model:MakeJoints()
Instead of clone() may work, or anchor the things and weld them possibly