I’ve tried using for i, v in pairs(blah:findtouchingparts()).
This is a “followup” to my last question that wasn’t actualy a issue lol
Full code
local Part = script.Parent.TalkSense
Part.Touched:Connect(function() end) -- Just for a TouchInterest to occur on a CanCollide false part
function CheckIfPlayerIsInArea(Part,Character)
local touching = Part:GetTouchingParts()
for i=1,#touching do
if touching[i] == Character.HumanoidRootPart then
return true
end
end
return false
end
script.coolok.Event:Connect(function(data)
if data[1] == "Request" then
local request = CheckIfPlayerIsInArea()
if request == true then
script.coolok:Fire({"Return",true})
else
script.coolok:Fire({"Return",false})
end
end
end)
local Part = script.Parent:WaitForChild("TalkSense")
Part.Touched:Connect(function() end) -- Just for a TouchInterest to occur on a CanCollide false part
script.coolok.Event:Connect(function(data,Character)
if data[1] == "Request" then
local touching = Part:GetTouchingParts()
for i=1,#touching do
if touching[i] == Character.HumanoidRootPart then
script.coolok:Fire({"Return",true})
end
end
script.coolok:Fire({"Return",false})
end
end)
code is slightly different now. don’t exactly know what i’d change to allow this lol
This callback is fine. All you are doing is creating an ‘anonymous’ function inside of the callback argument instead of declaring a function and then passing the reference.