So im working on a optimization setting for my game, i need it so that the click of a ui button it removes all parts that are named “Tree” in workspace.

I’ve tried other stuff for this but it still didnt work
for i, Instance in workspace:GetChildren() do
if Instance.Name == "Tree" then
Instance:Destroy()
end
end
1 Like
Thank you this worked, but last time i tried the same script it didnt work for some reason thank you
No prob, usually it’s because you’ve misspelled something if it doesn’t work. Typos are quite literally the bane of scripters lol.
1 Like
wait, optimization setting is for Remove() not Destroy() so if it Destroy() and if the player turns off how they going see trees?
use a remote event in order to trigger this if you want all players to see the trees bieng destroyed
Nah i just want it to stay local, for mobile optimization
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.