This script is just for me to learn more lua and i am trying to get every part on the manican to change transparency after 1 second every time
Dummy = script.Parent:GetChildren() function ghost() wait(1) Dummy.Transparency = 0.1 wait(1) Dummy.Transparency = 0.2 wait(1) Dummy.Transparency = 0.3 wait(1) Dummy.Transparency = 0.4 wait(1) Dummy.Transparency = 0.5 wait(1) Dummy.Transparency = 0.6 wait(1) Dummy.Transparency = 0.7 wait(1) Dummy.Transparency = 0.8 wait(1) Dummy.Transparency = 0.9 end game.Players.PlayerAdded:connect(ghost)
Also any way to shorten a Transparency script like this with time?
Please help me explain just a bit so i can understand the method you use :)
For loops. Not only will they make it work, they'll also shorten it. Two birds, one loop.
Or two, in this case.
local Dummy = script.Parent:GetChildren() function ghost() for i = .1, .9, .1 do --// The first number is what 'i' is initially set to. The second is the number it ends on, and the third is the increment (what it changes by after each iteration). wait(1) for _, child in pairs(Dummy) do --// We don't need the index, so we use the placeholder (_). child.Transparency = i end end end game.Players.PlayerAdded:connect(ghost)
Hope this helped.