#change the transparency of all the parts-unions in a model
20 messages · Page 1 of 1 (latest)
i literally was putting a script in every part that controlled it
while true do script.Parent.Transparency = 0 script.Parent.Transparency = .1 wait(.1) script.Parent.Transparency = .2 wait(.1) script.Parent.Transparency = .3 wait(.1) script.Parent.Transparency = .4 wait(.1) script.Parent.Transparency = .5 wait(.1) script.Parent.Transparency = .6 wait(.1) script.Parent.Transparency = .7 wait(.1) script.Parent.Transparency = .8 wait(.1) script.Parent.Transparency = .9 wait(.1) script.Parent.Transparency = 1 wait(300) script.Parent.Transparency = .9 wait(.1) script.Parent.Transparency = .8 wait(.1) script.Parent.Transparency = .7 wait(.1) script.Parent.Transparency = .6 wait(.1) script.Parent.Transparency = .5 wait(.1) script.Parent.Transparency = .4 wait(.1) script.Parent.Transparency = .3 wait(.1) script.Parent.Transparency = .2 wait(.1) script.Parent.Transparency = .1 wait(.1) script.Parent.Transparency = 0 wait(10) end
literally an eyesore nightmare but im not a scripter at all
i cant figure out a way for this to apply to a whole model and not an individual part
change the transparency of all the parts-unions in a model
you'd have to loop through all of the parts with a script
so something like this would go through all of the parts and set their transparency from 0 to 1 and then from 1 back to 0
for i, v in pairs(script.Parent:GetChildren()) do -- loop through whatever is in the folder/model your script is in
if v:IsA("Part") or v:IsA("UnionOperation") then -- check that the item is a part or union
for i = 1, 10 do
v.Transparency = v.Transparency + 0.1
task.wait(0.1)
end
for i = 1, 10 do
v.Transparency = v.Transparency - 0.1
task.wait(0.1)
end
end
end
** You are now Level 2! **
but then thats gonna wait until one part is done before moving onto the next, so i would use coroutines to make it effect all parts at once
which would give you something that looks like this
for i, v in pairs(script.Parent:GetChildren()) do -- loop through whatever is in the folder/model your script is in
if v:IsA("Part") or v:IsA("UnionOperation") then -- check that the item is a part or union
coroutine.resume(coroutine.create(function()
for i = 1, 10 do -- set the transparency from 0 to 1 over a 1 second duration
v.Transparency = v.Transparency + 0.1
task.wait(0.1)
end
for i = 1, 10 do -- set the transparency from 1 to 0 over a 1 second duration
v.Transparency = v.Transparency - 0.1
task.wait(0.1)
end
end))
end
end
ooooooorrrrr
use tween service!
yes thats another way
smolll nitpick, use task.spawn() isntead since it's idiomatic luau
and way more readable, coroutines at this point should just be considered for performance sensitive things
noo worries, have a nice day ^^