Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How can I select everything in the workspace through a script?

Asked by
zle_n 9
4 years ago
Edited 4 years ago

How could I for example select everything in the workspace to change it's transparency through a script? Or what can I use to make a script that'll do that.

I've tried to make it once but it didn't work and I don't understand what is wrong, could anybody help me?

player = script.Parent.Parent 
Mouse = player:GetMouse() 
children = workspace.lemodel:GetDescendants()


game.Players.LocalPlayer:GetMouse().KeyDown:Connect(function(KeyPressed)
    if KeyPressed == "f" then
    for index, descendant in pairs(children) do
    wait(0.5)
    children.Transparency = 0.1
    wait(0.5)
    children.Transparency = 0.2
    wait(0.5)
    children.Transparency = 0.3
    wait(0.5)
    children.Transparency = 0.4
    wait(0.5)
    children.Transparency = 0.5
    wait(0.5)
    children.Transparency = 0.6
    wait(0.5)
    children.Transparency = 0.7
    wait(0.5)
    children.Transparency = 0.8
    wait(0.5)
    children.Transparency = 0.9
    wait(0.5)
    children.Transparency = 1
    end
end
end)
1
workspace:GetDescendants theking48989987 2147 — 4y

1 answer

Log in to vote
0
Answered by
Nowaha 459 Moderation Voter
4 years ago
Edited 4 years ago

Replace all the children.Transparency = ... with descendant.Transparency = ...

You're changing a non-existant property of a table right now, not of the child selected in the for loop.

I also suggest moving children = workspace.lemodel:GetDescendants() into the function, instead of outside of it. The children might get modified but it won't update the list of descendants.

Ad

Answer this question