How to make screen flash when you are near part?

Hello!
I would like ask you guys how to make flash screen when you are near part and when you more and more near then the flash is more intensive
Thank for reading!

You can use rays and see if there’s a part in front of you. And then you can make the screen lighting increase in brightness? or you can make a Frame get less transparent.

Looking at the words he said, I think you should just have an effect run / increase depending on the magnitude of the local player

You can check the player’s magnitude to see if they’re close to a part or in a specific range. You’d need to get the distance of the player and divide it by the max extent of the range to get your intensity factor. This factor will determine how intense the screen flash will be:

local distance = (hrp.Position - part.Position).Magnitude
local RANGE = 20 -- the player will have to be in a range of 20 studs from the part for flashing to occur
local intensity_FACTOR = 1 - (distance / RANGE)

if intensity_FACTOR >= 0 then
    -- player is in range, commence flashing
end

For the flashing, you can alter the screen’s brightness or a frame’s transparency as mentioned by @Aldanium. You’d just need to multiply the effect by intensity_FACTOR

1 Like

Yeah but i don’t know how to make flash all my tries don’t worked

First of all you should get a Frame, usually white if you want white flash (or any color you want) .
Then insert the script @Raretendoblox provided .
Your flashing script, which is basically a fast sequence of transparency values ( 0 and 1) should be, if i am right, here.

if intensity_FACTOR >= 0 then
      --Insert flashing script here.
end

Oh my GOD I want know how to do flashing script no where insert it…

You would need to create a ScreenGui within StarterGuis, with a Frame inside this screengui. Afterwards you would then wantto insert @Raretendoblox script within this frame. Afterwards when the players distance is at a range that you want a flash you would write your code within the if statement.