I’m trying to create a rain system similar to Bloxburg’s, how it works is when your camera is under something (for example a part) the rain GUI goes away, then if your camera is not under a part it appears again.
How am I supposed to detect if a player’s camera is under a part?
I used Raycasting for my system; fire a ray upwards from the Player’s camera and if it hits something then it’s under something, if not then its under nothing.
Also you’ve listed this under the incorrect category.
I’ve made this script which seems to not work, I’ve tried creating 2 parts with the same positions and it was done as expected, do you know what I did wrong?
local raycastParam = RaycastParams.new()
raycastParam.FilterType = Enum.RaycastFilterType.Blacklist
local camera = workspace.CurrentCamera
local raycastResult = workspace:Raycast(camera.CFrame.Position, camera.CFrame.Position + Vector3.new(0, 100, 0))
while wait(3) do
if raycastResult then
print(raycastResult.Instance:GetFullName())
else
print("none")
end
end
(It was printing none even though my camera was under something)