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

I need some help, how do I make vanishing and reappearing spotlight/part?

Asked by 5 years ago
Edited 5 years ago
function onTouched()

 wait(.1)
 script.Parent.Transparency = 0.1
 wait(.1)
 script.Parent.Transparency = 0.2
 wait(.1)
 script.Parent.Transparency = 0.3
 wait(.1)
 script.Parent.Transparency = 0.4
 wait(.1)
 script.Parent.Transparency = 0.5
 wait(.1)
 script.Parent.Transparency = 0.6
 wait(.1)
 script.Parent.Transparency = 0.7
 wait(.1)
 script.Parent.Transparency = 0.8
 wait(.1)
 script.Parent.Transparency = 0.9
 wait(.1)
 script.Parent.Transparency = 1
 script.Parent.CanCollide = false
 wait(3)
 script.Parent.Transparency = 0
 script.Parent.CanCollide = true
end

script.Parent.Touched:connect(onTouched)? 
Show less                                                                                                                                                       second script                                                   local light = script.Parent.PointLight


while true do
    light.Enabled = false
    wait (math.random(0.1,1))
    light.Enabled = true
    wait (math.random (0.1,1))
end

0
I dont understand what question marks are used for.... greatneil80 2647 — 5y
0
I'm a bit confused... Did you already just do the same thing as the title or does it not work or is this another joke? mudathir2007 157 — 5y
0
/do you have any problems w/ the script? mudathir2007 157 — 5y
0
a part that repeats what? gamerboy0552 0 — 5y
View all comments (4 more)
0
Lol, he's probably sleeping or smth mixgingengerina10 223 — 5y
0
Like a part that vanishes and reappears, same thing with the light LordCervexian 0 — 5y
0
and no, this is not a joke...I only wanted some guidance from people like you...so if you would be so kind and tell me what I did wrong in this script? LordCervexian 0 — 5y
0
Like the script is not working so what do I do to fix it? that's my only question LordCervexian 0 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

I would do this:

visible = false
local part = script.Parent

part.Touched:connect(function()
    if visible == false then
        visible = true
        script.Parent.Transparency = 0.6
        for i = 0.6,1,0.02 do
            script.Parent.Transparency = i
            wait(0.01)
        end
        visible = false
        script.Parent.Transparency = 1
    end
end)
0
Yeah but I want it to repeat itself for a couple of seconds LordCervexian 0 — 5y
0
and I need the spotlight to flicker, you know? on and off? I'm trying to make a flickering red eye, that's what I'm doing here LordCervexian 0 — 5y
Ad

Answer this question