local function GetTouchingParts(part)
local connection = part.Touched:Connect(function() end)
local results = part:GetTouchingParts()
wait(1)
connection:Disconnect()
return results
end
local myPart = script.Parent
while true do
local touchingParts = GetTouchingParts(myPart)
for i, v in pairs(touchingParts) do
if v then
script.Parent.Value.Value = true
print("Touching Parts")
end
end
end
while true do
local Part = script.Parent
wait(1)
local Parts = Part:GetTouchingParts()
if not Parts then
print("Not Touching Parts")
script.Parent.Value.Value = false
end
end
What i’m trying to do i’m trying to make it so that when the block is not touching parts it will change a value to false , The part where it changes it to true works great! I just can’t find out how to make it so that when nothing is touching it, it will change the value
Yes if theres one part touching then it will change the value and print the Touching Parts, but If theres not parts touching the main part then it should change the value and print Not Touching Parts but for some reason it doesn’t want to print if theres no parts touching it.
local function GetTouchingParts(part)
return part:GetTouchingParts()
end
-------- main
local part = script.Parent
local touching = #GetTouchingParts(part) > 0 --boolean value, true if touching; false if not
local function GetTouchingParts(part)
return part:GetTouchingParts()
end
-------- main
local part = script.Parent
local touching = #GetTouchingParts(part) > 0 --boolean value, true if touching; false if not
while true do
wait(1)
if touching == false then
print("Touching Part")
else
print("No Touching Part")
end
end
local function GetTouchingParts(part)
return part:GetTouchingParts()
end
-------- main
local part = script.Parent
local touching = #GetTouchingParts(part) > 0 --boolean value, true if touching; false if not
while wait(1) do
touching = #GetTouchingParts(part) > 0
if touching then
print("Touching part")
else
print("No Touching Part")
end
end
local function GetTouchingParts(part)
local connection = part.Touched:Connect(function() end)
local results = part:GetTouchingParts()
wait(1)
connection:Disconnect()
return results
end
-------- main
local part = script.Parent
local touching = #GetTouchingParts(part) > 0 --boolean value, true if touching; false if not
while wait(1) do
touching = #GetTouchingParts(part) > 0
if touching then
print("Touching part")
else
print("No Touching Part")
end
end