-
Have a code,which basically checks,if player is in the zone,using GetPartBoundsInBox
-
Worked just fine,until last update,wondering if its just a coincidence,or it really did break something,now it keeps having issues,constantly couting that player left the zone and rentered non-stop,even if player dont move out of the zone
-
What strange is that i have other code,having exact same structure,yet it dont have this issue,and finds player normally
tried changing part directories,didnt work,
anchor and collide change didnt affect this either
-- while 1 do task.wait(0.25)
---------------------------------------------------------
local fndPlrInZn=false
---------------------------------------------------------
---------------------------------------------------------
--Setups bounding box
---------------------------------------------------------
local pdmTrgPrtSize = ovrlpTrgPrt.Size
local pdmTrgCFrame = ovrlpTrgPrt:GetPivot()
-------------------------------------------------------
local overlapParams = OverlapParams.new()
overlapParams.FilterType = Enum.RaycastFilterType.Exclude
overlapParams.FilterDescendantsInstances = {ovrlpTrgPrt}
local overlappingParts = workspace:GetPartBoundsInBox(pdmTrgCFrame, pdmTrgPrtSize, overlapParams)
-------------------------------------------------------
for _,obj in pairs(overlappingParts)do
---------------------------------------------------------
---------------------------------------------------------
--Tries to find plr
---------------------------------------------------------
local character = obj:FindFirstAncestorWhichIsA("Model")
---------------------------------------------------------
if character and game.Players:GetPlayerFromCharacter(character) then
---------------------------------------------------------
local fndPlr = game.Players:GetPlayerFromCharacter(character)
---------------------------------------------------------
---------------------------------------------------------
--If finds player,logic happens
---------------------------------------------------------
local plrNm=plr.Name
if fndPlr.Name == plrNm then fndPlrInZn=true
---------------------------------------------------------
if not plrIWasInTrgZn then print("PlrEntredTrgZn")
---------------------------------------------------------
local oldFrm=invClnPrntGui:FindFirstChildWhichIsA("Frame") if oldFrm then oldFrm:Destroy()end
---------------------------------------------------------
plrIWasInTrgZn=true
---------------------------------------------------------
SetupInventory(ovrlpTrgPrt)
task.wait(0.15)
---------------------------------------------------------
twnMdl.TweenGui("open", guiNm)
---------------------------------------------------------
CheckBuildingBeingPresent(ovrlpTrgPrt)
---------------------------------------------------------
---------------------------------------------------------
end
---------------------------------------------------------
end
---------------------------------------------------------
---------------------------------------------------------
end
---------------------------------------------------------
end
---------------------------------------------------------
if plrIWasInTrgZn and not fndPlrInZn then print("PlrLeftZone")
---------------------------------------------------------
twnMdl.TweenGui("close", guiNm)
twnMdl.TweenGui("close", "InvCloneGui")
--local oldFrm=invClnPrntGui:FindFirstChildWhichIsA("Frame") if oldFrm then oldFrm.Parent=plr.PlayerGui.TempGui end NOLAGSPIKE
local oldFrm=invClnPrntGui:FindFirstChildWhichIsA("Frame") if oldFrm then oldFrm:Destroy()end
plrIWasInTrgZn=false
end
---------------------------------------------------------
end
So again,did work until recent updates,now issue is it has constant flags issues,where overlap check says player left,even when player stays still
