Beams use 2D images that can be customized with properties to affect the color, size, or curvature.
- Copy the asset ID of an image you uploaded, or copy an ID from the examples below.
- In the beam’s Texture property, paste the asset ID.
- Make the laser appear brighter by changing a few properties.
- Add a faint glow by changing the LightEmission property to 0.5.
- Change Transparency to 0 (fully opaque).
- Make the beam wider by setting both Width0 and Width1 to 4.
- The TextureSpeed property animates the texture over time. For a fast, flickering effect, set it to 3.
- Make the laser look a bit more dangerous by changing its Color property.
Repeating or Static Textures
Textures have different modes, the default being Stretch which stretches the texture between the two attachments. Depending on your beam, you may want an alternative like Wrap or Static. Learn more on the TextureMode page.
The script for the trap will check if an invisible part is touches a player. The part is used since beams don’t have collision detection by default.
- In LaserTrap, create a new part named CollisionBox that overlaps the beam.
Anchor CollisionBox so it doesn’t move.
In the main model or part named LaserTrap, add a new script. Copy the code below and paste it into the new script.
local laserTrap = script.Parent local collisionBox = laserTrap:FindFirstChild("CollisionBox") -- Hide the collision box collisionBox.Transparency = 1 local function onTouch(otherPart) local character = otherPart.Parent local humanoid = character:FindFirstChildWhichIsA("Humanoid") if humanoid then humanoid.Health = 0 end end collisionBox.Touched:Connect(onTouch)
Test the trap by walking into the laser beam. If it’s not working correctly, make sure the script is in the right place and the collision box is properly named.
With the beam complete, explore additional beam properties like CurveSize0 and CurveSize1, import your own textures, or even make a new object like a force field.
Previous Page Getting Started