E to Open the Doors Assets: https://www.roblox.com/library/6690395183/E-to-Open-Doors
local SoundRegionsWorkspace = game.Workspace:WaitForChild("SoundRegions")
local Found = false
while wait(1) do
for i, v in pairs (SoundRegionsWorkspace:GetChildren())do
Found = false
local region = Region3.new(v.Position - (v.Size/2), v.Position + (v.Size/2))
local parts = game.Workspace:FindPartsInRegion3WithWhiteList(region,game.Players.LocalPlayer.Character:GetDescendants())
for _, part in pairs(parts) do
if part:FindFirstAncestor(game.Players.LocalPlayer.Name) then
print("player was found")
Found = true
break
else
Found = false
print("player was not found in region")
end
end
if Found == true then
if script.Parent.SoundRegions[v.Name].IsPlaying == false then
script.Parent.SoundRegions[v.Name]:Play()
break
end
else
script.Parent.SoundRegions[v.Name]:Stop()
end
end
end