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

How can I check a Part's properties in a script?

Asked by 3 years ago
Edited 3 years ago

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?

0
Did you say what happened if the condition wasn't met? Create an "else"; otherwise, the code may run regardless. AntiWorldliness 868 — 3y
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? Pogrommca 0 — 3y

Answer this question