Start typing to search packages!
Light Reflector
Latest Pre-Release Version: N/A
Latest Partially Stable Version: 2.3.1
A vehicle-based light reflector system that reflects Decals and BasePart reflectors at long distances on roads, built using Jecs.
[!IMPORTANT] Please use the main repository especially with contributions or commits! Additionally, please DO NOT make any changes in the mirrored repository as it cannot be pulled into the main repo.
The main repository is in Codeberg; however, I provided a push mirror on GitHub (pulls are not supported). Open an issue in Codeberg if you have concerns with this.
[!NOTE]
Codeberg Releases (
.rbxmdownload)https://codeberg.org/project-roadwork/light-reflector/releases
[!WARNING] This script is under
alphaand some functions may not work correctly or be unstable. Additionally, there is no external documentation for this module at the moment.
Wally / Pesde Notice
The Wally and Pesde packages are outdated! Unfortunately I cannot publish Pesde packages due to const usage.
Additionally, this is my first time using Pesde AND Wally - apologies if something is not formatted correctly.
Issues
- Broken Wally and Pesde packages, with mismatched versioning
- Rojo may not work correctly?
- Possible BasePart memory leak on games with Instance Streaming
Many:GetAttributecalls popping up in the Microprofiler- No external documentation
- Some signs and reflectors may not work at all in very rare occasions
Global features
- Adaptive waiting on performance-critical functions
- Distance fall-off
- Angle-based brightness
- Multi-vehicle support
- Non-tweened fading/transitions for gradual brightness
- Option to use
TagswithCollectionService - Uses Entity Component System via Jecs
Sign/Gantry System Features
- Utilizes
SurfaceGuisandImageLabelORDecalsby itself for reflectivity - Uses
.ImageTransparency,.Brightness, and.LightInfluence - SurfaceGui pooling to increase performance
- Automatic sign
:Dotsupport- This determines if the vehicle is facing the sign or not to determine reflectiveness
- Automatic part rotation for
Topfaces- Part rotation is needed since the orientation of images in
DecalsandSurfaceGuisare NOT the same - This may break the visuals of actual non-square parts due to rotations
- Part rotation is needed since the orientation of images in
- Best for large reflective highway signs on gantries
Reflector System Features
- Utilizes
BasePartsfor reflectivity - Uses
.Colorand.Material - Wedge
:Dotsupport, with face (Enum.NormalId) selection on non-wedges- This determines if the vehicle is facing the part or not to determine reflectiveness
- Best for pavement reflectors on the road
Hybrid System Features
- Works alongside the Reflector System with no separate loop needed
- Uses
.Color,.Material, AND.Transparencywith similar equations to the Sign/Gantry System - Face (
Enum.NormalId) selection - Best for reflective traffic light shields, non-decal signs, etc.
Essential Public API
.start()- Starts the module.reset()- Resets states and cleans up the module.config.applyOverrides({})- Parses user configuration before starting (if you cannot do it IN the module first).register.addVehicle(car: Instance, isHeadlightEnabled: () -> boolean, getIntensity: () -> number)- Registers vehicles into the module.register.removeVehicle(car: Instance)- Unregisters vehicles from the module
Example Usage
local LightReflector = require(path.to.module)
local function determineIntensity(car)
local finalIntensity = 1
-- logic to see if high beams are enabled or not (thus increase the intensity)
return finalIntensity
end
LightReflector.config.applyOverrides({
-- make any config changes here
})
LightReflector.start()
workspace.Cars.ChildAdded:Connect(function(car)
if car:IsA("Model") and car:FindFirstChildOfClass("VehicleSeat") then
print("Indexed Vehicle")
LightReflector.register.registerVehicle(car, true, determineIntensity) -- true is the placeholder of what "enables" the light source like a Headlight boolean value
end
end)
workspace.Cars.ChildRemoved:Connect(function(car)
if car:IsA("Model") and car:FindFirstChildOfClass("VehicleSeat") then
LightReflector.register.unregisterVehicle(car)
end
end)
Other examples such as server pre-tagging and a vehicle handler are provided in the examples folder.
Systems Diagram
[image: Diagram]
Older YouTube Showcase
Contributing
This section exists due to the file-level copyleft nature of the Mozilla Public License 2.0.
By contributing to this project, you agree that your contributions may be redistributed and relicensed by this project under other open-source and/or open-content licenses in the future (such as Apache-2.0).
View the reason why this clause exists in ./CONTRIBUTING.md
License
License: Mozilla Public License 2.0 (open source).
This may be changed to a more permissive license in the future, but unlikely.
[!NOTE]
Mozilla Public License 2.0 Summary
Warning: This summary does NOT act as a subsitute for the entire legal text. This is also not legal advice
The Mozilla Public License 2.0 (MPL-2.0) is a weak copyleft license.
You are free to:
- Use, modify, and distribute the code
- Use the code commercially (including games and/or proprietary software)
Under the following conditions:
- Any files originally from MPL that you modify must remain licensed under MPL
- You must make the source code of MPL-licensed files publicly available
- MPL-covered code must remain in separate files
In short: You can use MPL code in closed-source and/or commercial projects; however, any changes to MPL-covered files must stay open under MPL.
Compared to GPL/GNU licenses:
- GPL: May require the entire project (like games) to be fully open-sourced under GPL if GPL code is included
- LGPL: Allows use in proprietary projects, but requires that users can modify and swap out LGPL-covered code and still run the project with it, which is not very feasible with games and closed-source binary platforms such as ROBLOX. Additionally, this license allows users to reverse engineer entire projects
- MPL: Only requires open-sourcing the specific modified files
License Comparison (not legal advice)
| Feature / License | Expact (aka "MIT") | Apache 2.0 | MPL 2.0 | GPL / AGPL v3 |
|---|---|---|---|---|
| Permissive | ✅ | ✅ | ℹ️ Partial | ❌ |
| Patent Clause | ❌ | ✅ | ✅ | ✅ |
| Proprietary Use OK | ✅ | ✅ | ✅¹ | ❌ (Must release whole source) |
| Roblox Asset Usage | ✅ | ✅ | ℹ️ Depends; must share any changes | ❌ May violate terms |
- ¹ Proprietary use in MPL is permitted (allowed) as long as the MPL-covered files remain open souce.
Package Details
Install command (Click to copy)
Version
2.3.1
License
MPL-2.0
Usable with conditions
File-level copyleft: if you modify this package's own source files, those modified files must be made available under MPL-2.0. Using it unmodified in a closed-source game is fine.
Automated license review — not legal advice.
