I've been working on a game lately which is both a tycoon and fighting game in one. However the game is also team based so anyone can buy buildings for their team. That however is not what I'm troubled with. The buildings are meant to be destructable, so in that case they are needed to be unanchored. Everything is all set and the tycoon button's script has made the building disappear until a Player steps on the button. When someone actually DOES step on the Tycoon button, the whole building falls apart as if there was no studs or inlets. In case if you're wondering, I did weld parts, and put studs and inlets on each part.
Basically, in a shorter way to explain, I unanchored the parts of the building and put it with the Tycoon Button and it's script. After a Player touches the button, the building appears but falls apart even with studs, inlets, and welds.
Here is the Tycoon Button's Script:
------------------------------------------------------------------------------------------------------------------------- model = script.Parent.Parent.Parent.BlueVHouse Upgradecost = 5000 teamcolor = BrickColor.new("Bright blue") ------------------------------------------------------------------------------------------------------------------------- upgradeStuff = model:clone() model:remove() enabled = true --debouncer function onTouched(hit) if not enabled then return end enabled = false local 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 if game.Players:GetPlayerFromCharacter(hit.Parent).TeamColor ~= teamcolor then return end 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("Cash") --Get Cash 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() end end end enabled = true end if (script.Parent ~= nil) and (script.Parent.className == "Part") then connection = script.Parent.Touched:connect(onTouched) end
To fix this, add the following after line 28:
upgradeStuff:MakeJoints()
This will cause all joints to be remade, as they are normally broken in this case.