local function onPreSimulation(deltaTimeSim: number, instance: Instance, team: string)
local partBoundsInBox = Workspace:GetPartBoundsInBox(instance.CFrame, instance.Size)
if not table.find(partBoundsInBox, hitbox) then
if isTouching then
if localPlayer:GetAttribute("TouchMode") == "Shoot" then
localPlayer:SetAttribute("TouchMode", "Pass")
end
isTouching = false
print("Set false")
end
end
for key, part in partBoundsInBox do
if part ~= hitbox then
continue
end
if localPlayer.Team == team then
if localPlayer:GetAttribute("TouchMode") == "Pass" then
localPlayer:SetAttribute("TouchMode", "Shoot")
end
isTouching = true
print("Set true")
end
end
end
I have this script, and it basically just keeps bugging out whenever im inside the instance
area and the isTouching gets set to true and false back and forth
Im trying to detect whenever the player’s hitbox is NOT touching the instance