Hello!

I want an event to be launched only when a part (laser) has a specific property (to be more precise when it is not transparent). So I started the script like this:

local hurtLaser = script.Parent

if hurtLaser.Transparency < 1 then

But t doesn't work, no matter if the laser is currently transparent or visible, the rest of the script is executed.

Could someone please tell me how to fix it?

2 comments

0

Did you say what happened if the condition wasn't met? Create an "else"; otherwise, the code may run regardless.

0

Well, the rest of the script makes the laser hurt or kill a player. When it's transparent (and in the same time CanCollide is set to false) nothing should happen. How come the code may run when the condition isn't met?