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

How to make a beam appear after clicking a brick?

I'm getting no help so I'm trying again, I have a brick that is supposed to have a beam's transparency turn to 0 after clicking it. This is my current script, and it won't work, I don't have any Idea what I'm doing wrong.

script.Parent.ClickDetector.MouseClick:Connect(function() wait(3) script.Parent.Beam.Transparency = 0 end)

8 comments

0

Well, this is a messy way to do it, but as far as I can tell, this should work. I would check your hierarchy; did you get the correct location of everything?

0

Really does look like you might've gotten your hierarchy wrong

0

The website didn't load the script correctly, theres an indent between function and wait, and an indent between 0 and end.

0

The beam is inside a part and the script is also inside the part

0

Also, just like programming, the website did what you told it to do. In order to get it to display properly here, you need to put your code in a code block.

0

Is the beam a part?

0

It's clearly just an actual beam, not a part. He likely simply didn't expect he would need to use a Number Sequence - which to be fair, it is quite stupid you have to for simple transparency values.

0

It is not "clearly" an actual beam because he never specified what exactly the beam was and both parts and beams have a transparency value.

1 answer

✓ Accepted answer

It would help if you looked at, and provided, your errors in the console.

Transparency for beams in roblox is a number sequence, rather than a number. This makes it a bit trickier to modify, as whole numbers (As much as I wish roblox made them...) won't naturally convert over to the proper Number Sequence value.

Instead of turning the transparency to 0, if you are simply trying to turn the beam from invisible to visible, try turning it's Enabled property from False to True instead. This will make it pop on.

script.Parent.Beam.Enabled = true 

If you needed it to be a different transparency at the start, rather than off, you're going to have to look into number sequences.

https://developer.roblox.com/en-us/api-reference/datatype/NumberSequence

I honestly wish, since Beams appear as though they use a basic number, that roblox could naturally convert a number into a simple Number Sequence by itself, but that is sadly not how it works currently.

Hope I could help.

1 comment

1

Thank you! This finally worked!

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