while true do
wait()
--bool values
local part = script.Parent.Parent
local north = script.Parent.North
local south = script.Parent.South
local east = script.Parent.East
local west = script.Parent.West
--
--create rays
local whitelist = script.Parent.Parent
local northray = Ray.new(part.Position,Vector3.new(0,0,-1))
local southray = Ray.new(part.Position,Vector3.new(0,0,1))
local eastray = Ray.new(part.Position,Vector3.new(1,0,0))
local westray = Ray.new(part.Position,Vector3.new(-1,0,0))
local findnorth = workspace:FindPartOnRay(northray,script.Parent.Parent.Parent)
local findsouth = workspace:FindPartOnRay(southray,script.Parent.Parent.Parent)
local findeast = workspace:FindPartOnRay(eastray,script.Parent.Parent.Parent)
local findwest = workspace:FindPartOnRay(westray,script.Parent.Parent.Parent)
--
--change bool values based on whether rays are nil or not
if findnorth ~= nil then
north.Value = true
print("north found")
elseif findsouth ~= nil then
south.Value = true
print("south found")
elseif findeast ~= nil then
east.Value = true
print("east found")
elseif findwest ~= nil then
west.Value = true
print("west found")
elseif findnorth == nil then
north.Value = false
print("north not found")
elseif findsouth == nil then
south.Value = false
print("south not found")
elseif findeast == nil then
east.Value = false
print("east not found")
elseif findwest == nil then
west.Value = false
print("west not found")
end
--
end
Im trying to get some bool values to be true when its corrisponding ray hits something, and then turn false when nothing is found. when the script runs, only the north value gets turned true or false based on if its ray hits something or not.
all the other bool values do turn true when their ray hits, but they wont turn back to false.
