You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
When a part is in front of the player, it’s transparency becomes 0.75 -
What is the issue?
Ray does not detect part
here is the code:
wait(1)
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
--local castPoints = workspace:WaitForChild("CastPoints"):WaitForChild("Part").CFrame.p
--local ignorelist = {}
local RunService = game:GetService("RunService")
RunService.RenderStepped:Connect(function()
local function ArealTransparency(p0, p1)
local d = p1 - p0
local ray = Ray.new(p0, d)
local PartsObscuring = {}
repeat
local p = workspace:FindPartOnRayWithIgnoreList(ray, PartsObscuring)
table.insert(PartsObscuring, p)
until not p
return PartsObscuring
end
local Obscuring = ArealTransparency(workspace.Camera.CFrame.p, char.Head.Position)
print(Obscuring.Name)
Obscuring.Transparency = .75
end)
I think there might be a problem with the “repeat until” part of the code, but I really don’t know how to fix this.