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

Simple Touch Event won't work?

Brick = game.Workspace.Brick

function Spleef()

brick.Transparency = 0.1

wait(.1)

brick.Transparency = 0.2 0 wait(.1)

brick.Transparency = 0.3

wait(.1)

brick.Transparency = 0.4

wait(.1)

brick.Transparency = 0.5

wait(.1)

brick.Transparency = 0.6

wait(.1)

brick.Transparency = 0.7

wait(.1)

brick.Transparency = 0.8

wait(.1)

brick.Transparency = 0.9

wait(.1)

brick.Transparency = 1.0

end

Brick.Touched:connect(Spleef)

This should gradually make the part fade, correct? It would go from transparency 0-1 in 1 second when someone touches it. For some reason it doesn't. Does anyone see a problem?

2 answers

When you set the transparency, make sure brick is "Brick", as you defined it! Capital b. Reference a variable as it's defined. #1 law of variables.

1 comment

0

Oh wow. Duhh. I'm an idiot

Lots of problems in this script, and you can make it less complex, try this:

brick = game.Workspace.Brick
 
function Spleef()
	for i = .1, 1, 0.1 do
	brick.Transparency = i
end

script.Parent.Touched:connect(Spleef)

Remember to put this inside each Brick

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