What do you want to achieve? I want to add a Blur Effect ( using the Blur function in Lighting ) whenever one player ( so client-sided ) looks at a part.
What solutions have you tried so far?
Can’t find any
What do you want to achieve? I want to add a Blur Effect ( using the Blur function in Lighting ) whenever one player ( so client-sided ) looks at a part.
What solutions have you tried so far?
Can’t find any
You should use a ray that shoots from the player’s eyes.
When player looks the part? when player is near the part and looking at it?
You could use RayCasting, towards the camera point of view, if the ray finds specifically that part, change client side lighting.Blur.
You can check if a part is on screen by using the following code.
local Camera = workspace.CurrentCamera
local Part = workspace.Part
local _, visible = Camera:WorldToScreenPoint(Part.Position)
game.Lighting.Blur.Enabled = visible
-- i haven't tested this code, i just wrote it here so idk if it works or not
Doesn’t work unfortunately, may have to find another way to do it.
Can I see what your code looks like? Maybe I can try to fix it.
Oh ok, I can see the problem now. It needs to be in a loop, this is how you make a loop.
local RunService = game:GetService('RunService')
local Camera = workspace.CurrentCamera
local Part = workspace.Part
RunService.RenderStepped:Connect(function()
local _, visible = Camera:WorldToScreenPoint(Part.Position)
game.Lighting.BlurEffect.Enabled = (if visible then true else false)
end)
Thank you very much!!! I appreciate it a lot! Any way I can implement the size property aswell? If so, that’d be awesome!
Oh I think I have got it
local RunService = game:GetService('RunService')
local Camera = workspace.CurrentCamera
local Part = workspace.Part
RunService.RenderStepped:Connect(function()
local _, visible = Camera:WorldToScreenPoint(Part.Position)
game.Lighting.BlurEffect.Enabled = (if visible then true else false)
game.Lighting.BlurEffect.Size = x
end)
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.