hey guys i wanna ask for help, so basically what i want is. How to make the wall invisible when the camera facing towards the wall ?
2 Likes
Use raycasting
print(“char limit”)
1 Like
raycast?, hmmm let me try that
I assume you are talking about the player’s camera
Here is some code that you can customize:
wait()
local camera = game.Workspace.CurrentCamera
local direction = (game:GetService("Players").LocalPlayer.character.Head.Position - camera.CFrame.Position).Unit * 100 -- Change 100 to distance
local Parts = {} -- To make visible again
game:GetService("RunService").RenderStepped:Connect(function()
local ray = Ray.new(
camera.CFrame.Position,
direction
)
local ignore = game.Players.LocalPlayer.Character -- What to ignore
local hit, position = workspace:FindPartOnRay(ray, ignore)
if hit and hit:IsA("BasePart") then
table.insert(Parts, 1, hit)
hit.Transparency = 1
end
for i,v in pairs(Parts) do
if hit ~= v then
v.Transparency = 0
table.remove(Parts, i)
end
end
end)
2 Likes
sure its the players camera, thx for the code
2 Likes