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

My transparency script isn't working?

Asked by 10 years ago

I'm a beginner with scripting, and my script is breaking.

while true do
part = script.Parent

part.Transparency = 0.1
wait(3)
part.Transparency = 0.2
wait(3)
part.Transparency = 0.3
wait(3)
part.Transparency = 0.4
wait(3)
part.Transparency = 0.5
wait(3)
part.Transparency = 0.6
wait(3)
part.Transparency = 0.7
wait(3)
part.Transparency = 0.8
wait(3)
part.Transparency = 0.9
wait(3)
part.Transparency = 1
wait(3)

part:remove()
wait(3)
part:clone()
end

Is my script. Whenever it gets to the part to clone back, it doesn't clone back. Can someone help?

2 answers

Log in to vote
0
Answered by 10 years ago

When you remove the script it stops. You will need to clone it from somewhere else.

Instead of reseting the value of Transparency multiple times just use a loop. Also, I don't love scripts that are pointlessly copied so:

function transparency(part, waitTime)
    for i=0, 1, 0.1 do
        part.Transparency = i;
        wait(waitTime);
    end
end

transparency(part, 3);
Ad
Log in to vote
0
Answered by 10 years ago

It is because you cloned it, but after it was removed, giving it nothing to clone, aka, removed the script as well as the brick

Try editing it so that it copies it before it changes the transparency, or possibly put it in lighting, add the above script (Minus the clone) then enable/disable the script.

part = script.Parent

part.Transparency = 0.1
wait(3)
part.Transparency = 0.2
wait(3)
part.Transparency = 0.3
wait(3)
part.Transparency = 0.4
wait(3)
part.Transparency = 0.5
wait(3)
part.Transparency = 0.6
wait(3)
part.Transparency = 0.7
wait(3)
part.Transparency = 0.8
wait(3)
part.Transparency = 0.9
wait(3)
part.Transparency = 1
wait(3)

That would go in the part itself, name the script whatever I put below

while true do
model=game.Lighting.Brick --Change this to its name
modelcopy=model:Clone()
modelcopy.Parent=game.Workspace
modelcopy.Trans.Disabled=false--Make sure the above script is disabled
wait(30)
modelcopy:Destroy()

I am not the best scripter, if this does not work, i am sorry

Answer this question