I’m having a very annoying problem that I think many other of you guys already have this problem, but the problem is that the flashlight don’t illuminate correctly a on straight line (aka a hallway). The thing that i mean it is those 2 screenshots (it’s lightning technology is set by future btw):
one way to fix this is by making the flashlight a point light that moves to the mouse hit location, theres no way to currently increase the range of lights sadly.
If you need to make the light range smaller or larger or with variable brightness you need to code it yourself
by increasing the range and lowering brightness depending on distance
for example:
local maxDist = 90 -- at this point the light is at minimum brightness and at largest range
local minBrightness = .1
local maxBrightness = 1
local maxRange = 60
local function brightnessChange ()
local distance = (mouse.Hit.Position - Camera.CFrame.Position).Magnitude
pointlight.Range = math.clamp((maxRange/maxDist)*distance, 0, maxRange) -- changes the range variably depending on distance where maxDist is when the max range is hit
pointlight.Brightness = math.clamp((maxBrightness*maxDist)/distance, minBrightness, maxBrightness) -- does the opposite of light range
end
math.clamp sets the numbers between the minimum number and the maximum btw (if its over the max, it becomes the max, if it goes lower than the min, it becomes the min) if you didnt know already