#Transparency not looping

38 messages · Page 1 of 1 (latest)

primal chasm
#
local FB = script.Parent
 
 game.Workspace.AssetPack.DisappearingBlock.Touched:Connect(function()
        local FTran = FB.Transparency
        while FTran < 1 do
            task.wait(0.2)
            local FTran = FB.Transparency
            FTran = FTran + 0.1
            print("Trans Decreased")
        end
        
        if FTran == 1 then
            FB.CanCollide = false
            FB.CanTouch = false
        end
 end)

patent sundial
#

u addet 2 same variables

primal chasm
patent sundial
#

u alr defined it 1 time

primal chasm
#

no like

#

game.Workspace.AssetPack.FB.Touched:Connect(function()

#

instead of game.Workspace.AssetPack.DisappearingBlock.Touched:Connect(function()

#

@patent sundial

patent sundial
#

i dont get it what u want to do

#

Like the transparency isnt eorking right?

primal chasm
#

ye

patent sundial
#

just remove the second variable

#

or remove the local

primal chasm
#

u mean Ftran?

patent sundial
#

ye inside the while loop

primal chasm
#

local FB = script.Parent
 
FB.Touched:Connect(function()
        while FB.Transparency < 1 do
            task.wait(0.2)
            FB.Transparency = FB.Transparency + 0.1
            print("Trans Decreased")
        end
        
        if FB.Transparency == 1 then
            FB.CanCollide = false
            FB.CanTouch = false
        end
 end)

#

smthing like this?

#

oh it works

patent sundial
#

lol

#

U cant use local 2 times with the same name

patent sundial
#

If u want to acces it again for some reason

#

u do the same thing

#

without the local

primal chasm
#

ok

#

@patent sundial the collision still remains on tho

patent sundial
#

still colides?

#

remove the if statemnt

primal chasm
#

if FB.Transparency == 1 then
FB.CanCollide = false
FB.CanTouch = false
end

patent sundial
#

game.Workspace.AssetPack.DisappearingBlock.Touched:Connect(function()
local FTran = FB.Transparency
while FTran < 1 do
task.wait(0.2)
local FTran = FB.Transparency
FTran = FTran + 0.1
print("Trans Decreased")
end

        FB.CanCollide = false
        FB.CanTouch = false

end)

#

like this

primal chasm
#

just wondering why cant we keep the if statement

patent sundial
#

cuz the while loop wont stop till the transparecy is 1 anyway

#

maybe its glitching it

#

just test it

primal chasm
#

thx

patent sundial
#

works?

primal chasm