Hello, I have been trying to see whether a player is under a part, so I've been trying to use raycast. I've never used it before, so the problem here might be really simple. I looked at the developer's page on it and copied some of the script there directly to mine, so idk what's going on :)
here is my script:
local function rayCast(origin,direction,ignoreTable)
local raycastParams = RaycastParams.new()
raycastParams.FilterDescendantsInstances = ignoreTable
raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
local raycastResult = workspace:Raycast(origin,direction,raycastParams)
if raycastResult then
if not raycastResult.Instance.Parent:IsA("Accessory") then
game.Lighting.FogEnd = 100000000
else
game.Lighting.FogEnd = 100
end
else
game.Lighting.FogEnd = 100
end
end
game.Players.PlayerAdded:Connect(function(player)
local char = player.Character or player.CharacterAdded:Wait()
local head = char:WaitForChild("Head")
while wait() do
rayCast(head.Position,Vector3.new(0,-50,0),{workspace.Baseplate})
end
end)
thank you for reading :)

1 comment
Thank you