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

For i = do statement ?

Asked by 8 years ago

So i've done this to fade the head of a player smoothly, but I think it is happening too quickly so it just looks like it's instantaneous instead of a smooth fade to invisible.

Here is the block of code:

for i = 0,1, .1 do
                character.Head.Transparency = i
            end

If you could possibly explain this and help make it fade smoothly that would be great. Thank you.

1 answer

Log in to vote
2
Answered by
Pyrondon 2089 Game Jam Winner Moderation Voter Community Moderator
8 years ago

You need a wait. Without it, it runs as fast as it can, and as such looks instantaneous.

for i = 0,1, .1 do
    character.Head.Transparency = i
    wait(.1)
end

0
Thanks so much! TheScriptingAccount 90 — 8y
0
No problem, if you want to mark the question as answered accept my answer (not required). Pyrondon 2089 — 8y
Ad

Answer this question