For my game where you insult a tree and it will grow, I made a code that clones the tree to normal so players can use it again, But when it clones it and deletes the old one, But when the script that makes it bigger triggers it won't affect it on the new one, Can anyone help me?
Insult script
game.Players.PlayerAdded:Connect(function(player) player.Chatted:Connect(function(raw_msg) local msg = raw_msg:lower() local triggerWords = {"Hate", "Stupid", "Stink", "Stinks", "Sucks", "Bad", "Trash", "Awful", "Disgusting", "Horrible", "Disgust", "Mistake", "loser", "L", "School", "Homework"} local chattedWords = msg:split(" ") local function contains(list, x) for _,v in pairs(list) do if v:lower() == x:lower() then return true end end return false end for i, chattedWord in pairs(chattedWords) do local doesContain = contains(triggerWords, chattedWord) if doesContain == true then local tree = workspace:WaitForChild("MinimapObjects"):FindFirstChild("Tree") tree.Size = tree.Size * 2 end end end) end)
local script for new tree
local originalTree = workspace:FindFirstChild("MinimapObjects"):FindFirstChild("Tree") local newTree = game:GetService("ReplicatedStorage"):FindFirstChild("Tree") script.Parent.MouseButton1Click:Connect(function() local cloneTree = originalTree:Clone() cloneTree.Name = "Tree2" cloneTree.Size = Vector3.new(3.755, 4.2, 3.162) cloneTree.Position = Vector3.new(-96.692, 2.1, -28.789) originalTree:Destroy() cloneTree.Name = "Tree" cloneTree.Parent = workspace:FindFirstChild("MinimapObjects") end)