I have a part that will cause players to fly up when they are inside, and fall back down when they exit the part.
I have the enterance part covered as Im using GetTouchingParts() paired with touchinterest to get all the players within the part. however the challenge for me is to do something to that player when they are no longer inside the part, how can I do this?
here is what I have so far:
local cs = game:GetService("CollectionService")
local swimminglist = {}
function handlegravitypool()
for _, p in pairs(cs:GetTagged("AquaticDesert")) do
local pool = p:FindFirstChild("GravityPool")
pool.Pool.Touched:Connect(function()end)
local parts = pool.Pool:GetTouchingParts()
for _, p2 in next, parts do
if not swimminglist[p2] and p2:IsA("BasePart") and p2.Parent:FindFirstChild("Humanoid") then
print("inside")
swimminglist[p2] = p2.Parent.PrimaryPart
end
end
end
end
while true do
wait(1)
handlegravitypool()
end