Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

8 comments

0

I dont understand what question marks are used for....

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?

0

/do you have any problems w/ the script?

0

a part that repeats what?

0

Lol, he's probably sleeping or smth

0

Like a part that vanishes and reappears, same thing with the light

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?

0

Like the script is not working so what do I do to fix it? that's my only question

1 answer

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)

2 comments

0

Yeah but I want it to repeat itself for a couple of seconds

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

This discussion is preserved as it was. New answers, comments, and votes are closed.