Sim_Q1
(Sim)
May 11, 2022, 12:58am
#1
Hello There,
I am making a setting Screen Gui and I am Having a problem with Trying remove a Model when the Player clicks Remove Trees
If Someone Can tell me If My scripting is Wrong That Would Be helpful
Here’s my Local script!
script.Parent.MouseButton1Down:Connect(function()
game.Workspace.Vegetation.Model.Transparency = 1
end)
Official_Simulation
Sim_Q1
(Sim)
May 11, 2022, 12:59am
#2
And Vegetation is a Folder that the Model is in.
Sim_Q1
(Sim)
May 11, 2022, 1:01am
#4
It is a game.Workspace.Vegetation.Model
Model In the workspace.I haven’t checked Output yet.
Try this:
script.Parent.MouseButton1Down:Connect(function()
for i, v in pairs(game.Workspace.Vegetation.Model:GetChildren()) do
v.Transparency = 1
end
end)
Sim_Q1
(Sim)
May 11, 2022, 1:04am
#6
Ok I will try That and I will get back to you if It worked or not.
Sim_Q1
(Sim)
May 11, 2022, 1:05am
#7
It Did Nothing Sorry, Is there anything I’m missing in My Script?
Please check for any errors in the Output and send them here.
1 Like
Sim_Q1
(Sim)
May 11, 2022, 1:08am
#9
This is the Only Thing I’m getting.
Thanks! What kind of instance is Workspace.Vegetation.Model.Animated Tree
? You can check what type of instance it is with “ClassName” in the Properties Tab.
Sim_Q1
(Sim)
May 11, 2022, 1:11am
#11
It Is showing as a mesh part.
Well, if you really want to destroy it rather than make it invisible, this would work.
script.Parent.MouseButton1Down:Connect(function()
game.Workspace.Vegetation:ClearAllChildren() --Deletes all trees in folder
end)
Since you said it was a folder, why not delete all the trees in the folder?
2 Likes
That’s the ClassName for “Part”, which is not what I was looking for. Please try again with the instance that is called “Animated Tree”.
1 Like
workspace.Vegetation.Model:FindFirstChild(“Animated Tree”):ClearAllChildren()
Sim_Q1
(Sim)
May 11, 2022, 1:17am
#15
The Class Name For Animated Tree is saying Model
try my script for the transparency part
Sim_Q1
(Sim)
May 11, 2022, 1:18am
#17
Yes I should Of Done That Instead of making them invisible.
1 Like
script.Parent.MouseButton1Down:Connect(function()
for i, v in pairs(game.Workspace.Vegetation.Model:GetChildren()) do
v.Transparency = 1
end
for i, v in pairs(game.Workspace.Vegetation.Model["Animated Tree"]:GetChildren()) do
v.Transparency = 1
end
end)
If the above code snippet does not work, try this one below:
script.Parent.MouseButton1Down:Connect(function()
for i, v in pairs(game.Workspace.Vegetation.Model:GetDescendants()) do
v.Transparency = 1
end
end)
Can you copy the script again or get rid of .Model?
script.Parent.MouseButton1Down:Connect(function()
game.Workspace.Vegetation:ClearAllChildren() --Deletes all trees in folder
end)
Sim_Q1
(Sim)
May 11, 2022, 1:20am
#20
It Worked But How do I make were the player Can click it again and they appear? Is that Possible.