local playing = false
local sound = workspace.Folder.Sounds:WaitForChild("BaseSound")
workspace.Folder.Obby.Start:WaitForChild("BaseStart").Touched:Connect(function(hit)
if hit.Parent and hit.Parent:FindFirstChild("Humanoid") and not playing then
playing = true
print("Playing sound")
sound:Play()
sound.Ended:Wait()
playing = false
end
end)
workspace.Folder.Obby.Start.BasePart.HumanoidExited:Connect(function(hit)
if hit.Parent and hit.Parent:FindFirstChild("Humanoid") and playing then
playing = false
print("Stopping sound")
sound:Stop()
end
end)
Local script. Inside StarterPlayerScripts