I'm trying to make it to where you buy the car and have it spawn at its corrdinates with no problems. However there are 2 problems.
1) The car is anchored and I don't know how to unanchor it through scripting.
2) The Cloned model falls apart. I try :MakeJoints() but some parts still fall apart
Any Help?
Script:
COC = game.Workspace["Nissan 240SX(Car)"]:GetChildren() function OnTouched(hit) if hit.Parent:FindFirstChild("Humanoid") then local player = game.Players:GetPlayerFromCharacter(hit.Parent) if player then if player:FindFirstChild("leaderstats") then if player.leaderstats.Money.Value >= 68000 then player.leaderstats.Money.Value = player.leaderstats.Money.Value - 68000 local Clone = game.Workspace["Nissan 240SX(Car)"]:Clone() Clone.Parent = game.Workspace Clone:MakeJoints() Clone:MoveTo(Vector3.new(-27, 6.2, -877)) end end end end end script.Parent.Touched:connect(OnTouched)
You unachor it using Clone.Anchored = false
. Hoped I helped!
Try using the MakeJoints() method before putting the clone into the Workspace, and don't for get to anchor!
COC = game.Workspace["Nissan 240SX(Car)"]:GetChildren() function OnTouched(hit) if hit.Parent:FindFirstChild("Humanoid") then local player = game.Players:GetPlayerFromCharacter(hit.Parent) if player then if player:FindFirstChild("leaderstats") then if player.leaderstats.Money.Value >= 68000 then player.leaderstats.Money.Value = player.leaderstats.Money.Value - 68000 local Clone = game.Workspace["Nissan 240SX(Car)"]:Clone() Clone:MakeJoints() Clone.Anchored = false Clone.Parent = game.Workspace Clone:MoveTo(Vector3.new(-27, 6.2, -877)) end end end end end script.Parent.Touched:connect(OnTouched)