Alright so, I am having a hard time grasping on how to fix this problem. I am trying to make that if you are inside of an area, then a system message will appear; saying "Press Y to enter property."
This is how far I have come so far. I used Region3 Basically what happens is it doesn't send it once each time you enter.
local min = script.Parent.Min
local max = script.Parent.Max
local region3 = Region3.new(min.Position, max.Position)
local visual = Instance.new("Part")
visual.CanCollide = false
visual.Anchored = true
visual.CFrame = region3.CFrame
visual.Size = region3.Size
visual.Parent = script.Parent
visual.Transparency = 0.5
visual.Name = "Visual"
local ignorelist = {min,max}
local debounce = false
local RS = game:GetService('RunService')
RS.Heartbeat:Connect(function()
local partsInRegion = game.Workspace:FindPartsInRegion3WithIgnoreList(region3, ignorelist, math.huge)
for i,v in pairs(partsInRegion) do
if v.Parent:FindFirstChild("HumanoidRootPart") ~= nil then
print(v.Parent)
if not debounce then
debounce = true
game:GetService("ReplicatedStorage"):FindFirstChild("ChatEvent"):FireAllClients()
end
elseif v.Parent:FindFirstChild("HumanoidRootPart") == nil then
debounce = false
end
end
end)
Thanks you for your time, and I hope you can help :)
